LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-19-2006, 09:56 PM   #1
divineangel
LQ Newbie
 
Registered: Nov 2006
Posts: 3

Rep: Reputation: 0
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.
 
Old 11-19-2006, 10:12 PM   #2
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
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

Last edited by Wim Sturkenboom; 11-19-2006 at 10:14 PM.
 
Old 11-19-2006, 10:16 PM   #3
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
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.
 
Old 11-19-2006, 10:30 PM   #4
divineangel
LQ Newbie
 
Registered: Nov 2006
Posts: 3

Original Poster
Rep: Reputation: 0
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.
 
Old 11-19-2006, 11:19 PM   #5
divineangel
LQ Newbie
 
Registered: Nov 2006
Posts: 3

Original Poster
Rep: Reputation: 0
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.
 
  


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
Faster Upload to server? TomJon Linux - General 8 07-17-2006 09:07 PM
php upload an array of images spoody_goon Programming 3 05-22-2005 11:42 AM
Linux Server File Upload Problem? defa0009 Linux - General 4 05-05-2004 03:03 PM
cant upload to my server night Linux - Newbie 9 05-01-2004 03:40 PM
I want to upload some file to my server linux box vuthachh Linux - Newbie 2 04-22-2004 11:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:24 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
Open Source Consulting | Domain Registration