943,958 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 9913
  • PHP RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Apr 29th, 2009
0

Re: PHP File upload validation before the file uploads

First make your form something like the following:
html Syntax (Toggle Plain Text)
  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:
php Syntax (Toggle Plain Text)
  1. <?
  2. ini_set('upload_max_filesize','200M');
Sponsor
Featured Poster
Reputation Points: 410
Solved Threads: 258
Occupation: Genius
cwarn23 is offline Offline
3,004 posts
since Sep 2007
Apr 29th, 2009
0

Re: PHP File upload validation before the file uploads

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
shashank.kuls is offline Offline
8 posts
since Jul 2008
Apr 29th, 2009
-1

Re: PHP File upload validation before the file uploads

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.
Reputation Points: 8
Solved Threads: 0
Newbie Poster
marktoyota is offline Offline
1 posts
since Apr 2009
Apr 29th, 2009
1

Re: PHP File upload validation before the file uploads

Click to Expand / Collapse  Quote originally posted by marktoyota ...
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.
Reputation Points: 31
Solved Threads: 27
Unverified User
Josh Connerty is offline Offline
342 posts
since Apr 2009
Apr 30th, 2009
0

Re: PHP File upload validation before the file uploads

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:
html Syntax (Toggle Plain Text)
  1. <input name="Upload Saved Replay" type="file" accept="image/gif, image/jpeg"/>
Last edited by cwarn23; Apr 30th, 2009 at 5:45 am.
Sponsor
Featured Poster
Reputation Points: 410
Solved Threads: 258
Occupation: Genius
cwarn23 is offline Offline
3,004 posts
since Sep 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: file upload wont work!
Next Thread in PHP Forum Timeline: Pease Help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC