LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Permissions for file uploading script in php (https://www.linuxquestions.org/questions/programming-9/permissions-for-file-uploading-script-in-php-665564/)

emab 08-26-2008 01:28 PM

Permissions for file uploading script in php
 
I have installed LAMP server(Linux Apache, Mysql and PHP) in my suse11, and it's working well.

I got an scrip for uploading file but it doesn't upload my file:

first HTML page
Code:

<form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>


action of that page, uploader.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!";
}

What should i do? i think the problem is with permissions!

Mr. C. 08-26-2008 08:55 PM

I'm not going to spend time acting as a human PHP interpreter. What output or error messages appear in the log?

emab 08-27-2008 03:01 AM

I set the permissions!
in error log i saw a syntax error: unexpected ',' in ".../uploader.php"...

graemef 08-27-2008 05:49 AM

the syntax error in the log file would refer to a line number. It is helpful in such a situation to give the line number and also indicate (by checking it using an editor) which line of code that refers to. You have only posted part of the script so more help would be required if you are to receive more assistance.

emab 08-27-2008 11:50 AM

Line 5 of this code is the error!
I don't now about this function!

Mr. C. 08-27-2008 01:10 PM

Show all the code for the first 10 lines of the php code that is producing the error.

Show the EXACT error message. Don't interpret, or shorten the message.

If you want to do the interpretation, you get to do the diagnosis.

emab 08-31-2008 05:44 AM

error
 
the code is exactly what is in my file!

and the error is exactly in line 5 of this code(cuz only line five has a ',')

the error message is what i said: "unexpected "," in line 5"

graemef 08-31-2008 06:53 AM

what doesn't make sense about the code that you have posted is that there is no open php tag. So there appears to be something missing from the source code, hence the request for more detail.

To make everything much easier if you could copy and paste the code from the uploader.php file and the error message from the log file that will make it much easier for everyone.


All times are GMT -5. The time now is 02:34 AM.