LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   how to upload images on a linux server? (https://www.linuxquestions.org/questions/linux-software-2/how-to-upload-images-on-a-linux-server-503137/)

divineangel 11-19-2006 09:56 PM

how to upload images on a linux server?
 
Hi.

My php codes work well in Windows for uploading images but it doesn't seem to work on Linux server. Do you know the reason why? If yes, please reply to this post. Thank you.

Wim Sturkenboom 11-19-2006 10:12 PM

It will help us if you tell what is going wrong? And maybe post the code (in code tags).

One thing that always comes to mind in a situation where something works in Windows but not in Linux is the fact the Linux is case sensitive and Windows isn't. So abc.JPG is not the same as abc.jpg.

PS there is a dedicated programming forum where this question fits better

theNbomr 11-19-2006 10:16 PM

When you try to upload files to a linux server, the server process will be the owner of the file. Does that user (possibly 'apache') have write permissions in the destination directory of the file? The server may be chrooted to the htdocs (or whatever the document root directory is), and unable to see any directory outside of that subdirectory tree.

--- rod.

divineangel 11-19-2006 10:30 PM

Quote:

Originally Posted by divineangel
Hi.

My php codes work well in Windows for uploading images but it doesn't seem to work on Linux server. Do you know the reason why? If yes, please reply to this post. Thank you.



Here's the fragment of my code for saving the file:

else if ($action == "SAVE") {

define('IMAGE_PATH',DIR_FS_COMMON.'images/');
$arr_data = array();
$ImageFileName = date('Ymdhms').$_FILES['BANNER_IMAGE']['name'];
if ($ImageFileName != '')
$arr_data["BANNER_IMAGE"] = $ImageFileName;
$arr_data["BANNER_URL"] = $_POST["BANNER_URL"];
$arr_data["BANNER_URL_JP"] = $_POST["BANNER_URL_JP"];
$con_banner_obj = new ConBanner();
$con_banner_obj->save($arr_data);
if ($ImageFileName != '')
move_uploaded_file($_FILES['BANNER_IMAGE']['tmp_name'], IMAGE_PATH.$ImageFileName);
header('location:index.php');

}

the filename is passed to 'BANNER_IMAGE', i wasn't thinking about case sensitivity.

divineangel 11-19-2006 11:19 PM

Hello. Thank you for your replies. I really appreciate them. I can now upload images on the Linux server. There are some settings which i changed in the upload folder and now it's working. :)

This might be used for future reference so i'm posting it for everybody:

***Setting the security on a linux server using telnet/ssh***

1.Find your upload folder on the server.
You need to locate the folder where you want to upload to.
2.Change the security settings
Type chmod 777 uploadfolder or chmod 666 uploadfolder, the 777 also alows execute and the 666 only read and write. When you have changed the permission you should be able to upload to that folder.

***Setting the security on a linux server using ftp***

1.Find your upload folder on the server.
Go browse with the ftp software you are using to your site. Select the upload folder you created.
2.Change the security settings
Set the right permissions for everyone, the picture can differ depending on the ftp software you are using. It is called CHMOD, Attributes or Permissions.


All times are GMT -5. The time now is 07:58 AM.