LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-12-2008, 03:23 PM   #1
bandit8
LQ Newbie
 
Registered: Feb 2008
Posts: 2

Rep: Reputation: 0
php file upload to linux server


Hi,

I have a Flash movie that allows a user to upload an image to a server, using a php script. Once uploaded, the file is then loaded into the Flash movie from the server so that it is displayed to he user.

I had all of this working totally fine on a shared-hosting server I had been using... but I recently switched over to a dedicated-virtual server, and as soon as I did it stopped working! The progress bar shows that the file is being uploaded, but then 'hangs' at the end, and does nothing. Logging into the server via ftp, I can see that the file was indeed successfully uploaded, however it won't let me delete it off of the server (it says I don't have permission). Looking at the properties of the file on the server, it shows the user and group as 'apache', where as on the old server it showed the user as my ftp login, and allowed me to delete it.

I can't figure out why it keeps 'hanging', and why the Flash movie won't load in the file. All of the Flash coding, and PHP settings (i.e. safe_mode, upload_max_filesize, etc.) all match the old server..so I'm stumped.

The code I'm using in PHP to upload the file is:

PHP Code:
   <?php
$folderName 
$_GET[num];
//create the directory if doesn't exists (should have write permissons)
if(!is_dir("pix/$folderName")) mkdir("pix/$folderName"0755); 
//move the uploaded file
move_uploaded_file($_FILES['Filedata']['tmp_name'], "pix/$folderName/".$_FILES['Filedata']['name']);
chmod("pix/$folderName/".$_FILES['Filedata']['name'], 0777);
?>
Any suggestions/ideas would be greatly appreciated. If you need clarification of anything, please just let me know.

Thanks!
-b.
 
Old 02-12-2008, 03:56 PM   #2
Digital Diablo
LQ Newbie
 
Registered: Apr 2007
Location: Colorado, USA
Distribution: CentOS 5
Posts: 11

Rep: Reputation: 0
There are a few things to check, but the first I would look at is the dir permissions of the parent dir of the folder you are attempting to upload to. You can set it to 777 to ensure you can upload but that isn't totaly safe, hopefully you could get away with a 755. I could bet the dir is currently set to 644(default).

-Digital Diablo

Quote:
Originally Posted by bandit8 View Post
Hi,

I have a Flash movie that allows a user to upload an image to a server, using a php script. Once uploaded, the file is then loaded into the Flash movie from the server so that it is displayed to he user.

I had all of this working totally fine on a shared-hosting server I had been using... but I recently switched over to a dedicated-virtual server, and as soon as I did it stopped working! The progress bar shows that the file is being uploaded, but then 'hangs' at the end, and does nothing. Logging into the server via ftp, I can see that the file was indeed successfully uploaded, however it won't let me delete it off of the server (it says I don't have permission). Looking at the properties of the file on the server, it shows the user and group as 'apache', where as on the old server it showed the user as my ftp login, and allowed me to delete it.

I can't figure out why it keeps 'hanging', and why the Flash movie won't load in the file. All of the Flash coding, and PHP settings (i.e. safe_mode, upload_max_filesize, etc.) all match the old server..so I'm stumped.

The code I'm using in PHP to upload the file is:

PHP Code:
   <?php
$folderName 
$_GET[num];
//create the directory if doesn't exists (should have write permissons)
if(!is_dir("pix/$folderName")) mkdir("pix/$folderName"0755); 
//move the uploaded file
move_uploaded_file($_FILES['Filedata']['tmp_name'], "pix/$folderName/".$_FILES['Filedata']['name']);
chmod("pix/$folderName/".$_FILES['Filedata']['name'], 0777);
?>
Any suggestions/ideas would be greatly appreciated. If you need clarification of anything, please just let me know.

Thanks!
-b.
 
Old 02-12-2008, 04:32 PM   #3
bandit8
LQ Newbie
 
Registered: Feb 2008
Posts: 2

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Digital Diablo View Post
There are a few things to check, but the first I would look at is the dir permissions of the parent dir of the folder you are attempting to upload to. You can set it to 777 to ensure you can upload but that isn't totaly safe, hopefully you could get away with a 755. I could bet the dir is currently set to 644(default).

-Digital Diablo
Hi Digital Diablo,

Appreciate your response, however that was actually the first thing I checked... I have it currently set to 777, and that still doesn't solve the problem. I had been hoping it was something as simple as that when I first discovered the problem...but unfortunately it was not, and has been boggling my mind.

-b.
 
  


Reply


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
php file upload lord-fu Programming 2 04-30-2006 12:03 AM
PHP upload file to other server antony_csf Programming 13 02-04-2005 04:11 AM
Linux Server File Upload Problem? defa0009 Linux - General 4 05-05-2004 04:03 PM
I want to upload some file to my server linux box vuthachh Linux - Newbie 2 04-23-2004 12:46 AM
File upload via PHP!!! saravanan1979 Programming 0 02-14-2002 02:55 AM


All times are GMT -5. The time now is 08:32 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration