Forum Moderators: coopster

Message Too Old, No Replies

2 questions for $ FILES

         

bufoss

11:44 am on Oct 10, 2009 (gmt 0)

10+ Year Member



Hi,
I use a form to upload an image and I save the image in a directory.

my file is stored in variable $_FILES[$fieldname].
how can I take the type (for example .jpeg,.gif,...), the name and the size of the image ?

$_FILES[$fieldname][name]
gives as result all

And another question.
I want to pass the variable in an another php file (success_upload_image.php) using header function.
header('Location: ' . $uploadSuccess?file='what I have to write here...');
And in the other file how can I call the file ?

Thanks a lot for your help

omoutop

12:31 pm on Oct 12, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



for your first question:
if you type : print_r($_FILES[$fieldname]);
you will see all data of your image (name, size, type, errors)

for your second question: since you have alredy upload your photo, all you have to use is the name of it
for example: header('Location: some_page.php?file='.$_FILES[$fieldname]['name']);
In your trget page you $_GET your image name and procceed with your script