472,958 Members | 2,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

Problem with file upload in forum

I'm running a forum on a debian box and all of a sudden my uploads don't
seem to be working anymore.

The code for the upload is the folowing:

sub _save_file{
my ($self, $file_hdr, $file_name) = @_;
my ($ret, $bytesread, $data);

open (SAVE, ">$config->{'file_path'}/$file_name") or die "an error
occured:
while ($bytesread = read($file_hdr,$data,1024)) {
print SAVE $data;
}
close SAVE;
$ret = -s "$config->{'file_path'}/$file_name";
return $ret;

Is there something wrong with this code?
Because I'm getting files with a filesize of 0 kb instead of the real
filesize.
Jul 19 '05 #1
1 2897
Maarten wrote:
I'm getting files with a filesize of 0 kb instead of the real filesize.
sub _save_file{
my ($self, $file_hdr, $file_name) = @_;


return(warn("file_hdr is not an open file handle"),-1)
unless defined fileno($file_hdr);

-Joe

P.S. Post to comp.lang.perl.misc instead of comp.lang.perl next time.
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: John Machin | last post by:
Sorry in advance if this is not the correct forum ... I'm trying to upload what appears to be a perfectly OK zip file as a "source" file type to PyPI, and am getting this response: Error......
5
by: Andy Mee | last post by:
Hello one and all, I'm developing an Asp.NET system to take a CSV file uploaded via the web, parse it, and insert the values into an SQL database. My sticking point comes when I try to split()...
4
by: R Reyes | last post by:
I am trying to code a file uploader (for forum/email attachments) from the client computer to a remote web server via the PUT method (since POST is not allowed ). However, the upload works ONLY...
5
by: Segfahlt | last post by:
I need a little help here please. I have 2 win forms user controls in 2 different projects that I'm hosting in 2 different virtual directories. The controls have been test and operate okay in...
8
by: Cristian | last post by:
Hi. I've developer on my web page a uploader files sytem, but I can't find a solution for looking the file size before the upload. Please some help!! Bye Franc
1
by: Redapple | last post by:
Hello everybody, Im a beginner in PHP and i'm thinking how i can make more things on my own made upload script: Sorry if this is the wrong forum or if its not allowed to ask for script...
3
by: Eminosoft | last post by:
The below code can't take the images.plz tell that what is the problem in that code <?php // Connect to database $errmsg = ""; if (! @mysql_connect("localhost","root","sreeni")) { ...
1
by: sravani1 | last post by:
This code runs like when i submit the form it takes the image and displayed and top of the image a map will displayed. But actually i want that when i give the image it checks the location in the map...
11
by: kj | last post by:
I would like to convert a form that currently uses the traditional CGI sequence (i.e. the action associated with the form sends a POST request to a server-side CGI script) to one that uses AJAX to...
12
by: K. | last post by:
Hello! I have a problem with SWFupload class1. I have the page with uses SWFUpload class. Everything worked fine until (I suppose my admin) implemented some changes into the server. Now uploading...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.