...

View Full Version : How do I get the true image name from this?



ozlad
05-05-2006, 04:00 AM
This may be a silly question.

I am using this to select a photo for upload and resizing

<form action="addinfo.php" encType="multipart/form-data" method="post" name="sendform">
<input name=MAX_FILE_SIZE type=hidden value=1000000>
<input name=image type=file ACCEPT="image/jpeg, image/jpg">
<input type=submit name=submit value=Submit>
</form>

Question is, how to I get the true image name from this to check if file exists before addinfo.php does the upload, resizing and whatever?

chump2877
05-05-2006, 09:46 AM
I don;t know if this quite answers your question, but there are couple ways to validate image files:

1) is_file() -- http://us2.php.net/manual/en/function.is-file.php
2) getimagesize() -- http://us2.php.net/manual/en/function.getimagesize.php

and maybe more ways that I cant think of right now...

degsy
05-05-2006, 03:25 PM
You can use the $_FILES global to get the name
http://uk.php.net/features.file-upload

ozlad
05-05-2006, 10:39 PM
Thanks degsy, I spent a few hours looking for that yesterday.
Much appreciated



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum