LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-26-2008, 01:28 PM   #1
emab
LQ Newbie
 
Registered: Aug 2008
Posts: 12

Rep: Reputation: 0
Question 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!
 
Old 08-26-2008, 08:55 PM   #2
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 59
I'm not going to spend time acting as a human PHP interpreter. What output or error messages appear in the log?
 
Old 08-27-2008, 03:01 AM   #3
emab
LQ Newbie
 
Registered: Aug 2008
Posts: 12

Original Poster
Rep: Reputation: 0
I set the permissions!
in error log i saw a syntax error: unexpected ',' in ".../uploader.php"...
 
Old 08-27-2008, 05:49 AM   #4
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
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.
 
Old 08-27-2008, 11:50 AM   #5
emab
LQ Newbie
 
Registered: Aug 2008
Posts: 12

Original Poster
Rep: Reputation: 0
Line 5 of this code is the error!
I don't now about this function!
 
Old 08-27-2008, 01:10 PM   #6
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 59
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.
 
Old 08-31-2008, 05:44 AM   #7
emab
LQ Newbie
 
Registered: Aug 2008
Posts: 12

Original Poster
Rep: Reputation: 0
Red face 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"
 
Old 08-31-2008, 06:53 AM   #8
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
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.
 
  


Reply

Tags
file, php5, upload


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
uploading file with POST from PHP issue lukebeales Programming 2 04-23-2008 08:54 PM
Executing a script when uploading a file to a SAMBA SERVER rafa_gallego Linux - Server 4 01-18-2008 05:39 AM
setting permissions on a file after uploading via FTP dgsr2002 Linux - Newbie 4 10-21-2004 07:15 PM
PHP and File Uploading Tomasfuego Linux - Software 6 08-12-2004 09:20 AM
Error uploading file with PHP jacksmash Programming 8 11-22-2003 11:11 AM


All times are GMT -5. The time now is 05:06 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration