PHP File upload validation before the file uploads

Reply

Join Date: Sep 2007
Posts: 1,518
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 136
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Posting Virtuoso

Re: PHP File upload validation before the file uploads

 
0
  #11
Apr 29th, 2009
First make your form something like the following:
  1. <form enctype="multipart/form-data" action="uploader.php" method="POST">
  2. Upload File:
  3. <input name="Upload Saved Replay" type="file" accept="image/gif, image/jpeg"/><br />
  4. Below line is the essential line.
  5. <input type="hidden" name="MAX_FILE_SIZE" value="200000000" />
  6. <input type="submit" value="Upload File" />
  7. </form>
And in the php side, add the following to the top of your page:
  1. <?
  2. ini_set('upload_max_filesize','200M');
Try not to bump 10 year old threads as it can be really annoying.
http://syntax.cwarn23.net/
Smilies: ^_* +_+ v_v -_- *~*`
My favourite PC. - MacGyver Fan
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 8
Reputation: shashank.kuls is an unknown quantity at this point 
Solved Threads: 0
shashank.kuls shashank.kuls is offline Offline
Newbie Poster

Re: PHP File upload validation before the file uploads

 
0
  #12
Apr 29th, 2009
Thanks But I've solved this issue..........
Use $_SERVER['CONTENT_LENGTH'] after trying to upload file. This variable returns size of uploaded file, even if upload failed
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 1
Reputation: marktoyota is an unknown quantity at this point 
Solved Threads: 0
marktoyota marktoyota is offline Offline
Newbie Poster

Re: PHP File upload validation before the file uploads

 
-1
  #13
Apr 29th, 2009
What type of file you are uploading, Image of Video file??? have you got solution or still looking for solution.
Last edited by Ezzaral; Apr 29th, 2009 at 1:09 pm. Reason: Snipped fake sig spam links.
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 340
Reputation: Josh Connerty is an unknown quantity at this point 
Solved Threads: 26
Josh Connerty's Avatar
Josh Connerty Josh Connerty is offline Offline
Posting Whiz

Re: PHP File upload validation before the file uploads

 
1
  #14
Apr 29th, 2009
Originally Posted by marktoyota View Post
What type of file you are uploading, Image of Video file??? have you got solution or still looking for solution.
I am actually still having the issue I can change the settings in my ini but what I am trying to do is validate all the information about the uploaders file before they actually upload it else they spend maybe 5 minutes or so uploading the file to be told it has the wrong extension...

This is a big issue and has ground the work down to a halt.
Last edited by Ezzaral; Apr 29th, 2009 at 1:12 pm. Reason: Snipped the spam links from the post you quoted.
Posts should be like mini-skirts, long enough to cover enough, but not too long that you cover too much.

My Liveperson: http://liveperson.com/josh-connerty/
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,518
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 136
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Posting Virtuoso

Re: PHP File upload validation before the file uploads

 
0
  #15
Apr 30th, 2009
It is possible to use html to validate the file format simply by using the accept= method in the upload field. Below is an example that only accepts gif files and jpeg files:
  1. <input name="Upload Saved Replay" type="file" accept="image/gif, image/jpeg"/>
Last edited by cwarn23; Apr 30th, 2009 at 5:45 am.
Try not to bump 10 year old threads as it can be really annoying.
http://syntax.cwarn23.net/
Smilies: ^_* +_+ v_v -_- *~*`
My favourite PC. - MacGyver Fan
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC