Re: [PHP] uploads

2007-05-02 Thread Richard Lynch
On Sun, April 29, 2007 4:35 pm, jekillen wrote:
 can someone point me to a system for cleaning
 uploaded files; embedded php scripts in image
 files, viruses etc, shell escape chars, anything
 that would be hazardous?
 The idea is when a file is uploaded, as soon
 as it gets to the server it is inspected, cleaned/rejected
 before it is used or sent anywhere else on the server.
 I am using php to upload anything that would be sent
 in an e-mail attachment. Once the files have been
 'sanitized' they would be made available for display.

What you are asking for is a blacklist of all known viruses...

At that point, you'd want to run something huge like clam-av and/or
spamassassin and/or a generic anti-virus software.

For *most* PHP web applications, what you REALLY want is a very very
very limited allowed set of whitelist of kinds of files to upload --
like only images and PDFs.

If that's what you actually want, it's better to try to check that the
uploaded files *ARE* images or PDFs, than it is to try to rule out
every possible virus ever invented...

I.e., a security whitelist approach is almost always better than a
blacklist approach.

Of course, if you are writing a generic email client type application,
then, yes, you have to go with a generic anti-virus tool like clam-av
or whatever.

It almost-for-sure won't actually be in PHP, and you'll probably have
to use http://php.net/exec, and you may even need to re-think the
general architecture so that the inbound email gets put into some kind
of normal mail queue, and then scrubbed, and then passed into some
kind of normal IMAP mailbox, and then PHP reads the IMAP mailbox, with
PHP taking a hands off approach to the actual scrubbing.

At least, that's the way *I* would do it.  Errr, am doing it.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] uploads

2007-04-29 Thread jekillen

Hello again;
can someone point me to a system for cleaning
uploaded files; embedded php scripts in image
files, viruses etc, shell escape chars, anything
that would be hazardous?
The idea is when a file is uploaded, as soon
as it gets to the server it is inspected, cleaned/rejected
before it is used or sent anywhere else on the server.
I am using php to upload anything that would be sent
in an e-mail attachment. Once the files have been
'sanitized' they would be made available for display.
Thanks in advance;
Jeff k

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] uploads

2007-04-29 Thread Tijnema !

On 4/29/07, jekillen [EMAIL PROTECTED] wrote:

Hello again;
can someone point me to a system for cleaning
uploaded files; embedded php scripts in image
files, viruses etc, shell escape chars, anything
that would be hazardous?
The idea is when a file is uploaded, as soon
as it gets to the server it is inspected, cleaned/rejected
before it is used or sent anywhere else on the server.
I am using php to upload anything that would be sent
in an e-mail attachment. Once the files have been
'sanitized' they would be made available for display.
Thanks in advance;
Jeff k



What's your platform? Windows or Linux?

Tijnema

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] progress bar for use with PHP uploads

2002-11-12 Thread Kenn Murrah
Greetings 

Can anyone point me in the direction of a Javascript code snippet that would display a 
progress bar for a PHP upload?  I'm sure it can be done that way, but honestly, I lack 
the Javascript skills to make it happen   

Any and all help would be appreciated.

Thanks.

Kenn




Re: [PHP] progress bar for use with PHP uploads

2002-11-12 Thread Ernest E Vogelsinger
At 17:27 12.11.2002, Kenn Murrah spoke out and said:
[snip]
Can anyone point me in the direction of a Javascript code snippet that would 
display a progress bar for a PHP upload?  I'm sure it can be done that way, 
but honestly, I lack the Javascript skills to make it happen   
[snip] 

If I understood you correctly you want to accomplish something like

a) you have a file upload form
b) user clicks upload, and a progress meter is displayed
c) when the upload is done, the progress meter will be at 100% and vanish
or tell finished or something like that

I'm afraid this cannot be done very easily. What you'd need to know at the
moment the user clicks on upload would be the actual filesize, and the
average transmission speed so you can estimate the pace to go from 0 to
100. And, you need both values at the client's, a server side script is not
yet active at this time.

I'd suggest to take the easy road (seen on a couple of other sites)...
Create an animated gif with a progress bar constantly scrolling. In your
form's onSubmit() method (at the client's side!), do a window.open() with
the appropriate parameters to generate a small window without any controls,
sized sufficiently to just contain this gif.

The URL of this popup would be a PHP script (with the same session ID of
the uploader) which would basically do this:

if (!$_SESSION['popup_opened']) {
$_SESSION['popup_opened'] = true;
send_popup_html();
}
elseif (!$_SESSION['xmit_done'])
header('HTTP/1.0 204 No Content');
else send_close_html();

send_popup_html would add a header to refresh the popup:
header('Refresh: 1;
URL=http://'.$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']?SID);

send_close_html would simply send html like
body onload='window.close();'

I hope you get the idea... Basically the crucial stuff is the refresh
header for the popup url that causes the client to _try_ to refresh every
second. As long as the transfer is not finished, the popup script simply
replies with 204 No Content, so the browser would change nothing with the
popup. When the upload is eventually finished, the refresh request
succeeds, but the only stuff the client receives is a javascript closing
the popup...


-- 
   O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/



Re: [PHP] progress bar for use with PHP uploads

2002-11-12 Thread 1LT John W. Holmes
There's no way to know the percentage of the file that's uploaded, so you
can't have a true progress indicator. You could just use a little popup that
shows a 'wait, we're doing something' graphic that the following page closes
when it loads.

---John Holmes...

- Original Message -
From: Kenn Murrah [EMAIL PROTECTED]
To: php list [EMAIL PROTECTED]
Sent: Tuesday, November 12, 2002 11:27 AM
Subject: [PHP] progress bar for use with PHP uploads


Greetings 

Can anyone point me in the direction of a Javascript code snippet that would
display a progress bar for a PHP upload?  I'm sure it can be done that way,
but honestly, I lack the Javascript skills to make it happen 

Any and all help would be appreciated.

Thanks.

Kenn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] uploads work sometimes

2002-07-12 Thread Jason Wong

On Friday 12 July 2002 03:27, Tyler Longren wrote:
 Hi,

 I have a form:
 input type=file name=pdfFile

 And the code that processes the form:
 if ($_FILES['pdfFile']['name'] == ) {
   print You must select a file to upload;
 }
 else {
   // code to add data to db
 }

 This works on my server at home (when I select a file to upload, it sees
 the filename in $_FILES['pdfFile']['name'], but on a server at work,
 it's blank so I see the error You must select a file to upload.

 Any ideas on why this might happen?  Is there anything in php.ini that
 could be wrong (it works here at home when register_globals is set to on
 or off)?

What would help is what version(s) of php are you using?

Things to check:

If php  4.1.X then $_FILES[] is not available, use $HTTP_POST_FILES[],

If upload fails for any reason then (I believe), $_FILES['pdfFile']['name'] 
would be empty. So:

php.ini -- upload enabled? Are the other settings governing uploads set to 
reasonable values? Check manual  Handling file uploads  Common Pitfalls to 
see what these settings are.

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Machines that have broken down will work perfectly when the repairman arrives.
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] uploads work sometimes

2002-07-11 Thread Tyler Longren

Hi,

I have a form:
input type=file name=pdfFile

And the code that processes the form:
if ($_FILES['pdfFile']['name'] == ) {
print You must select a file to upload;
}
else {
// code to add data to db
}

This works on my server at home (when I select a file to upload, it sees
the filename in $_FILES['pdfFile']['name'], but on a server at work,
it's blank so I see the error You must select a file to upload.

Any ideas on why this might happen?  Is there anything in php.ini that
could be wrong (it works here at home when register_globals is set to on
or off)?

Thanks everyone,
Tyler

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Uploads adding \r?

2002-05-07 Thread Cole Tuininga


I'm using PHP on a customer's site.  One of the things they do is to add
a dxf (CAD) file to be associated with parts.  The peculiar thing is
this: When the file gets uploaded, the EOL gets changed from \n to
\r\n.

Initially, I thought this was some kind of weird M$ thing (web server is
apache 1.3.mumble with php 4.1.2 on linux), but I tried uploading from
my linux box with the same result. 

Any thoughts?

-Cole Tuininga


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Uploads

2002-01-21 Thread Ronald Tezuka

If anyone can help me out, that'd be greatly appreciated.  I'm trying to 
create an upload form.  Now I've checked both in books and online, and maybe 
it's becuase I'm trying a weird application, but I can't seem to get uploads 
greater than 6 megs.  If it is greater than 6 megs, it loads up a blank page 
even if I have the PHP script that outputs an HTML file.  Anyway I checked 
online when I was first did this and figured out to increase the max value 
in the php.ini file from 2 megs to much higher.  I'm still having trouble 
though.
Here's what I am using
Omnihttpd 2.09
PHP 4.02
Windows 98 (4.10.1998)
and IE 4.72.3110
So if anyone knows why I can't upload files greater than 6 megs 
(approximate) it'd be greatly appreciated if you'd help me.  Thanks

Ron

_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Uploads

2002-01-21 Thread Jim Lucas [php]

make sure you increase your script timeout limit.
Jim Lucas
- Original Message -
From: Ronald Tezuka [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, January 21, 2002 2:50 PM
Subject: [PHP] Uploads


 If anyone can help me out, that'd be greatly appreciated.  I'm trying to
 create an upload form.  Now I've checked both in books and online, and
maybe
 it's becuase I'm trying a weird application, but I can't seem to get
uploads
 greater than 6 megs.  If it is greater than 6 megs, it loads up a blank
page
 even if I have the PHP script that outputs an HTML file.  Anyway I checked
 online when I was first did this and figured out to increase the max value
 in the php.ini file from 2 megs to much higher.  I'm still having trouble
 though.
 Here's what I am using
 Omnihttpd 2.09
 PHP 4.02
 Windows 98 (4.10.1998)
 and IE 4.72.3110
 So if anyone knows why I can't upload files greater than 6 megs
 (approximate) it'd be greatly appreciated if you'd help me.  Thanks

 Ron

 _
 Send and receive Hotmail on your mobile device: http://mobile.msn.com


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Uploads

2002-01-21 Thread Dennis Moore

make sure you set the max_file_size in your form.

   ie input type=hidden name=MAX_FILE_SIZE value=800

or set it in your php.ini or .htaccess file.

/dkm

- Original Message -
From: Ronald Tezuka [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, January 21, 2002 5:50 PM
Subject: [PHP] Uploads


 If anyone can help me out, that'd be greatly appreciated.  I'm trying to
 create an upload form.  Now I've checked both in books and online, and
maybe
 it's becuase I'm trying a weird application, but I can't seem to get
uploads
 greater than 6 megs.  If it is greater than 6 megs, it loads up a blank
page
 even if I have the PHP script that outputs an HTML file.  Anyway I checked
 online when I was first did this and figured out to increase the max value
 in the php.ini file from 2 megs to much higher.  I'm still having trouble
 though.
 Here's what I am using
 Omnihttpd 2.09
 PHP 4.02
 Windows 98 (4.10.1998)
 and IE 4.72.3110
 So if anyone knows why I can't upload files greater than 6 megs
 (approximate) it'd be greatly appreciated if you'd help me.  Thanks

 Ron

 _
 Send and receive Hotmail on your mobile device: http://mobile.msn.com


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Uploads

2002-01-21 Thread Ronald Tezuka

Okay, I changed the max execution time from 30 seconds to 3000 seconds 
(approximately 50 minutes)  It still happens though.  Is there a client side 
timeout (browser) that I need to change?  I couldn't find any sort of option 
like that in Internet Explorer.

Ron


From: Jim Lucas [php] [EMAIL PROTECTED]
To: [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: Re: [PHP] Uploads
Date: Mon, 21 Jan 2002 15:01:37 -0800

make sure you increase your script timeout limit.
Jim Lucas
- Original Message -
From: Ronald Tezuka [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, January 21, 2002 2:50 PM
Subject: [PHP] Uploads


  If anyone can help me out, that'd be greatly appreciated.  I'm trying to
  create an upload form.  Now I've checked both in books and online, and
maybe
  it's becuase I'm trying a weird application, but I can't seem to get
uploads
  greater than 6 megs.  If it is greater than 6 megs, it loads up a blank
page
  even if I have the PHP script that outputs an HTML file.  Anyway I 
checked
  online when I was first did this and figured out to increase the max 
value
  in the php.ini file from 2 megs to much higher.  I'm still having 
trouble
  though.
  Here's what I am using
  Omnihttpd 2.09
  PHP 4.02
  Windows 98 (4.10.1998)
  and IE 4.72.3110
  So if anyone knows why I can't upload files greater than 6 megs
  (approximate) it'd be greatly appreciated if you'd help me.  Thanks
 
  Ron
 
  _
  Send and receive Hotmail on your mobile device: http://mobile.msn.com
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 





_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Uploads

2002-01-21 Thread Ronald Tezuka

I've got it set to 100 megs for both the browser and the php.ini file, I 
just set a really high limit as not to come close to the files I am trying 
to upload.  However it still seems to load up a blank page and doesn't 
upload the file if greater than 6 megs.

Ron


From: Dennis Moore [EMAIL PROTECTED]
To: [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: Re: [PHP] Uploads
Date: Mon, 21 Jan 2002 18:23:25 -0500

make sure you set the max_file_size in your form.

ie input type=hidden name=MAX_FILE_SIZE value=800

or set it in your php.ini or .htaccess file.

/dkm

- Original Message -
From: Ronald Tezuka [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, January 21, 2002 5:50 PM
Subject: [PHP] Uploads


  If anyone can help me out, that'd be greatly appreciated.  I'm trying to
  create an upload form.  Now I've checked both in books and online, and
maybe
  it's becuase I'm trying a weird application, but I can't seem to get
uploads
  greater than 6 megs.  If it is greater than 6 megs, it loads up a blank
page
  even if I have the PHP script that outputs an HTML file.  Anyway I 
checked
  online when I was first did this and figured out to increase the max 
value
  in the php.ini file from 2 megs to much higher.  I'm still having 
trouble
  though.
  Here's what I am using
  Omnihttpd 2.09
  PHP 4.02
  Windows 98 (4.10.1998)
  and IE 4.72.3110
  So if anyone knows why I can't upload files greater than 6 megs
  (approximate) it'd be greatly appreciated if you'd help me.  Thanks
 
  Ron
 
  _
  Send and receive Hotmail on your mobile device: http://mobile.msn.com
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]





_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Uploads

2002-01-21 Thread Jason Wong

On Tuesday 22 January 2002 07:35, Ronald Tezuka wrote:
 I've got it set to 100 megs for both the browser and the php.ini file, I
 just set a really high limit as not to come close to the files I am trying
 to upload.  However it still seems to load up a blank page and doesn't
 upload the file if greater than 6 megs.

Did you restart the webserver after changing the settings?

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
I can hire one half of the working class to kill the other half.
-- Jay Gould
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Uploads

2002-01-21 Thread Bogdan Stancescu

Ok, I've run into this myself. Two possible reasons:
1. PHP
2. MySQL

NOT POSSIBLE REASON: execution time. You only get to execution time after
uploading the data, so that doesn't count - you may take long to send the actual
file, not afterwards.

Ok, the two possibilities:
1. PHP
php.ini, as you suggested may be the problem (i.e. you don't allow PHP to use
more than 6 megs memory, so it can't store the larger-than-6-megs file you
upload). However, the default PHP setting is 8 MB in this regard, so you
shouldn't have problems at 6 megs.

2. MySQL
If you use MySQL then there's a limit for query size - I suppose you _do_
something with that file, and since that usually is storing it into a database
and the general database system of choice is MySQL, I think my suggestion is not
as far fetched as it may prove to be in the end. (too long a phrase, huh?) So,
if that's the case, you should check this out:

You can also get these errors if you send a query to the server that is
incorrect or too large. If mysqld gets a packet that is too large or out of
order, it assumes that something has gone wrong with the client and closes the
connection. If you need big queries (for example, if you are working with big
BLOB columns), you can increase the query limit by starting mysqld with the -O
max_allowed_packet=# option (default 1M). The extra memory is allocated on
demand, so mysqld will use more memory only when you issue a big query or when
mysqld must return a big result row!
-

Bogdan

Ronald Tezuka wrote:

 If anyone can help me out, that'd be greatly appreciated.  I'm trying to
 create an upload form.  Now I've checked both in books and online, and maybe
 it's becuase I'm trying a weird application, but I can't seem to get uploads
 greater than 6 megs.  If it is greater than 6 megs, it loads up a blank page
 even if I have the PHP script that outputs an HTML file.  Anyway I checked
 online when I was first did this and figured out to increase the max value
 in the php.ini file from 2 megs to much higher.  I'm still having trouble
 though.
 Here's what I am using
 Omnihttpd 2.09
 PHP 4.02
 Windows 98 (4.10.1998)
 and IE 4.72.3110
 So if anyone knows why I can't upload files greater than 6 megs
 (approximate) it'd be greatly appreciated if you'd help me.  Thanks

 Ron

 _
 Send and receive Hotmail on your mobile device: http://mobile.msn.com

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] PHP Uploads - Please Help!!

2001-07-24 Thread Corin Rathbone

Sorry to again bring up the subject, but could somebody please help me with
multiple
file uploads. I've written the script below, but it doesn't seem to work
properly.
please help. Alternatively, could somebody give me a simple upload script.
My system is Win 98, Apache 1.3.17, php 4.0.5, IE5. The code is below.

Thanks,
Corin Rathbone

?php
$root_path = E:/System/htdocs;

if(isset($uploads_go)){
  static $worked = array();
  for($x=0; $x9; $x++){
$current_file = $userfile[$x];
  $current_file_name = $userfile_name[$x];
  $current_file_size = $userfile_size[$x];
$current_file_path = $root_path.$path_to_file[$x];

print( $xbr\n );
print( $current_filebr\n );
  print( $current_file_namebr\n );
  print( $current_file_sizebr\n );
  print( $current_file_pathbrbr\n );

if(!$current_file=){
  if(!file_exists($current_file_path)){
//copy($current_file, $current_file_path);
//unlink($current_file);
  $fp = fopen($current_file_path, wb) or die(Could not write
file!);
fwrite($fp, $current_file) or die(Could not write file!);
  fclose($fp) or die(Could not close file pointer!);
$worked[] = 1;
  }
  else{
//die(File does not exists!);
  }
}
else{
  $worked[] = 0;
}
  }
}
elseif(!isset($uploads_go)){  
$cfg_upload_max_filesize = get_cfg_var(upload_max_filesize);
print( form action=\upload.php\ method=\post\ 
enctype=\multipart/form-data\\n );
  print(   input type=\hidden\ name=\MAX_FILE_SIZE\ 
value=\$cfg_upload_max_filesize\\n );
  print(   input type=\hidden\ name=\uploads_go\ value=\1\\n );
  print(   Upload these files:br\n );
  print(   File: input name=\userfile[0]\ type=\file\brPath: input 
type=\text\ name=\path_to_file[]\ size=\40\brbr\n );
  print(   File: input name=\userfile[1]\ type=\file\brPath: input 
type=\text\ name=\path_to_file[]\ size=\40\brbr\n );
  print(   File: input name=\userfile[2]\ type=\file\brPath: input 
type=\text\ name=\path_to_file[]\ size=\40\brbr\n );
  print(   File: input name=\userfile[3]\ type=\file\brPath: input 
type=\text\ name=\path_to_file[]\ size=\40\brbr\n );
  print(   File: input name=\userfile[4]\ type=\file\brPath: input 
type=\text\ name=\path_to_file[]\ size=\40\brbr\n );
  print(   File: input name=\userfile[5]\ type=\file\brPath: input 
type=\text\ name=\path_to_file[]\ size=\40\brbr\n );
  print(   File: input name=\userfile[6]\ type=\file\brPath: input 
type=\text\ name=\path_to_file[]\ size=\40\brbr\n );
  print(   File: input name=\userfile[7]\ type=\file\brPath: input 
type=\text\ name=\path_to_file[]\ size=\40\brbr\n );
  print(   File: input name=\userfile[8]\ type=\file\brPath: input 
type=\text\ name=\path_to_file[]\ size=\40\brbr\n );
  print(   File: input name=\userfile[9]\ type=\file\brPath: input 
type=\text\ name=\path_to_file[]\ size=\40\brbr\n );
  print(   input type=\submit\ value=\Send files\\n );
  print( /form );
}
elseif(isset($worked)){
  for($x=0; $x9; $x++){
if($worked[$x]){
  print( The file upload for file $path_to_file[$x] was successfulbr\n );
}
else{
  print( The file upload for file $path_to_file[$x] was bnot/b 
successfulbr\n );
}
  }
}
else{
  print( div class=\main-center\Please select files to be uploaded/div );
}

?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] PHP Uploads - Sorry!!!

2001-07-23 Thread Corin Rathbone

Sorry to again bring up the subject, but could somebody please help me with
file uploads. I have written the script below, but it doesn't work properly.
please help. Alternatively, could somebody give me a simple upload script.
My system is Win 98, Apache 1.3.17, php 4.0.5, IE5. The code is below.

Thanks,

Corin Rathbone

?php
$root_path = E:/System/htdocs;

if(isset($uploads_go)){
  static $worked = array();
  for($x=0; $x9; $x++){
$current_file = $userfile[$x];
  $current_file_name = $userfile_name[$x];
  $current_file_size = $userfile_size[$x];
$current_file_path = $root_path.$path_to_file[$x];

print( $xbr\n );
print( $current_filebr\n );
  print( $current_file_namebr\n );
  print( $current_file_sizebr\n );
  print( $current_file_pathbrbr\n );

if(!$current_file=){
  if(!file_exists($current_file_path)){
//copy($current_file, $current_file_path);
//unlink($current_file);
  $fp = fopen($current_file_path, wb) or die(Could not write
file!);
fwrite($fp, $current_file) or die(Could not write file!);
  fclose($fp) or die(Could not close file pointer!);
$worked[] = 1;
  }
  else{
//die(File does not exists!);
  }
}
else{
  $worked[] = 0;
}
  }
}
elseif(!isset($uploads_go)){  
$cfg_upload_max_filesize = get_cfg_var(upload_max_filesize);
print( form action=\upload.php\ method=\post\ 
enctype=\multipart/form-data\\n );
  print(   input type=\hidden\ name=\MAX_FILE_SIZE\ 
value=\$cfg_upload_max_filesize\\n );
  print(   input type=\hidden\ name=\uploads_go\ value=\1\\n );
  print(   Upload these files:br\n );
  print(   File: input name=\userfile[0]\ type=\file\brPath: input 
type=\text\ name=\path_to_file[]\ size=\40\brbr\n );
  print(   File: input name=\userfile[1]\ type=\file\brPath: input 
type=\text\ name=\path_to_file[]\ size=\40\brbr\n );
  print(   File: input name=\userfile[2]\ type=\file\brPath: input 
type=\text\ name=\path_to_file[]\ size=\40\brbr\n );
  print(   File: input name=\userfile[3]\ type=\file\brPath: input 
type=\text\ name=\path_to_file[]\ size=\40\brbr\n );
  print(   File: input name=\userfile[4]\ type=\file\brPath: input 
type=\text\ name=\path_to_file[]\ size=\40\brbr\n );
  print(   File: input name=\userfile[5]\ type=\file\brPath: input 
type=\text\ name=\path_to_file[]\ size=\40\brbr\n );
  print(   File: input name=\userfile[6]\ type=\file\brPath: input 
type=\text\ name=\path_to_file[]\ size=\40\brbr\n );
  print(   File: input name=\userfile[7]\ type=\file\brPath: input 
type=\text\ name=\path_to_file[]\ size=\40\brbr\n );
  print(   File: input name=\userfile[8]\ type=\file\brPath: input 
type=\text\ name=\path_to_file[]\ size=\40\brbr\n );
  print(   File: input name=\userfile[9]\ type=\file\brPath: input 
type=\text\ name=\path_to_file[]\ size=\40\brbr\n );
  print(   input type=\submit\ value=\Send files\\n );
  print( /form );
}
elseif(isset($worked)){
  for($x=0; $x9; $x++){
if($worked[$x]){
  print( The file upload for file $path_to_file[$x] was successfulbr\n );
}
else{
  print( The file upload for file $path_to_file[$x] was bnot/b 
successfulbr\n );
}
  }
}
else{
  print( div class=\main-center\Please select files to be uploaded/div );
}

?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]