Jump to content

Recommended Posts

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 PHP code Flash ueses to upload the file is:

 

<?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.

Link to comment
https://forums.phpfreaks.com/topic/90691-php5-file-upload-to-linux-server/
Share on other sites

You need to make sure your server root is writtable by the apache user. I would also join the apache group, this should enable you to delete these files via ftp.

 

Is this a managed vps? If not, you really ought to get to know some server admin.

 

Hi thorpe, thanks for your reply.

 

I have a complete control over the server...but will openly admit I know very little about servers, or apache! How would I go about ensuring that the server root is writtable by the apache user?

 

Thanks for any further suggestions you can provide.

 

-b.

p.s. I had a colleague who knows a lot more about linux/vim editing then me play around with it yesterday, and he added my ftp user as part of the apache group...but was baffled by how it still wouldn't let me delete....or what could be causing this problem in general.

What are the permissions on the pix directory?

 

The permissions are 777 ... that was one of the first things I checked (I had been hoping it would be something that simple!)... so that can't be affecting Flash's ability to read in the image...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.