It is currently Thu Sep 21, 2017 8:45 am


All times are UTC


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Permissions for client upload of binary file
PostPosted: Fri Nov 12, 2010 6:07 pm 
Newbie
Newbie

Joined: Tue Mar 25, 2008 9:01 pm
Posts: 3
I wrote Perl code for the client upload of a binary image file and got it to work on the Apache offline emulator for my windows PC. Trying to use this code on FreeHostia I get the following error message:

Software error:
CGI open of tmpfile: Read-only file system

For help, please send mail to the webmaste ({email: "support at freehostia dot com}),
giving this error message and the time and date of the error.

My research on the Internet indicates that Perl creates a temporary file of the binary file before storing it in the target folder but needs a temporary folder to put it in that has the appropriate UNIX permissions (ie. 777). I created a tmp file in my own space (permission 777) but that does not work even when I include in the code the CGI pragma that searches for this very file as a temporary file. I read on one web page that all the permissions in the directory structure leading to the temporary file must be 777 for the 'tmp' file to function as a receiver for the temporary file but the 'www' directory in my space is 755 and I cannot change it.

My Perl code stops and generates the error message when it reaches the following command:

my $query = new CGI;

I would appreciate anyone's help in telling me what I am missing.

Thanks,
Mark


Top
 Profile  
 
 Post subject: Solution to Problem.
PostPosted: Thu Dec 16, 2010 1:33 pm 
Newbie
Newbie

Joined: Tue Mar 25, 2008 9:01 pm
Posts: 3
After being in contact with some very nice people at Perl Monks, I seem to have found enough of a solution to this problem to allow my image uploads to occur on Freehostia.

First, a directory named 'tmp' has to be added to the root directory of the domain with permissions set at '777'.

Second, code that appears below has to be added to the script before the 'use CGI;' command appears:

BEGIN{
$ENV{'TMPDIR'} = "/home/www/mydomain.com/tmp";
}

Part one adds a directory to the domain with correct permissions so that the CGI module will have a place to put its temporary image file while it is being uploaded. Part two makes the temporary directory known to the CGI module by declaring it in the ENV hash after it is passed to the cgi script uploading the image file. The CGI module specifically looks in the ENV hash to find a place to put its temporary file. The CGI module apparently can't see the 'tmp' directory without this ENV entry even though it is supposed to look for it.

Mark


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 16, 2010 4:37 pm 
Support Tech
Support Tech

Joined: Tue May 09, 2006 2:27 am
Posts: 933
Hello Mark,

I'm glad to hear that the problem has been resolved.

_________________
Andy
ModeratorsTeam
Freehostia.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ]  Moderators: Moderators, Support Team

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Hosting | Domains | Servers | Extras | Order | Support | Contacts | FreeHostia © 2011