TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   Determine if file was uploaded? (http://www.talkphp.com/absolute-beginners/1677-determine-if-file-uploaded.html)

Andrew 12-08-2007 10:28 PM

Determine if file was uploaded?
 
I'm creating an order form for PSDtoCode, and I'm trying to determine if the user uploaded a file, so I know whether or not to call my function which uploads the image.

Order.php page:
http://phpfi.com/281991
Order.class.php page:
http://phpfi.com/281992

Line 9 on the order.php page is what is causing troubles for me, because that if statement is returning the wrong value, always the "no image uploaded" option.

What's a better way to determine if a file was uploaded?

Wildhoney 12-08-2007 10:40 PM

is_uploaded_file will do the trick.

http://uk3.php.net/is_uploaded_file

Andrew 12-08-2007 10:46 PM

Didn't seem to work. I'm going to test out a few other things, though.

I seem to be now getting more errors, with my checkFile() function, and uploading still isn't working. :(

Rendair 12-08-2007 11:45 PM

PHP Code:

$target_path "uploads/";

$target_path $target_path basename$_FILES['uploadedfile']['name']); 

if(
move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
    echo 
"The file ".  basename$_FILES['uploadedfile']['name']). 
    
" has been uploaded";
} else{
    echo 
"There was an error uploading the file, please try again!";




All times are GMT. The time now is 01:38 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0