site Search:


 
    All Forums Hot Topics Gallery






how-to block ads


 
Search Topic:
Uniqs:
757
Share Topic
Posting?
Post a:
Post a:
Links: ·How To Get Noticed ·Web Monks FAQ ·Webhosting FAQ ·Posting Code ·How To Post ·Webhosting forum
AuthorAll Replies


Nordy

join:2007-10-20

Right method to begin server side validation for file upload

What is the right way to begin validation for data sent by a multipart/form form. I'll be receiving a file and 1 text identifier from a hidden field.

I can handle checking for file type and size and all else. What I'm asking is the initial code. Form a normal form I usually do this:

<?php
 
If ($_POST)
{
 
if (isset($_POST['myField]) && $_POST['myField'] == 1)
{
//Proceed with the rest
}else{
echo 'Error';
}
}
else
{
echo 'Some Error';
}
?>
 

What's the best way to do it when it come to multipart/form data? How do u pros / experienced guys do it?

Thanks,
Norman


MVS
Premium
join:2005-04-18

You can use the $_FILES array to access the uploaded file. See this page for more information and sample code: »www.php.net/manual/en/features.f···thod.php



sbconslt

join:2009-07-28
Los Angeles, CA

reply to Nordy
PHP manages all the plumbing / decoding for you. You don't have to deal with it.



Nordy

join:2007-10-20

reply to Nordy
In the end the $_FILES thingy did the job. Thanks, both of you.


Wednesday, 22-May 06:23:53 Terms of Use & Privacy | feedback | contact | Hosting by nac.net - DSL,Hosting & Co-lo
over 13.5 years online © 1999-2013 dslreports.com.
Most commented news this week
Hot Topics