XUpload - Files not copying

Message
Author
sandyinc
Posts: 7
Joined: Dec 15, 2006 8:30 pm

Files not copying

#1 Postby sandyinc » Dec 15, 2006 8:49 pm

I'm running the free version on XP to test and I'm having some issues. (yes, I know XP + free = broken)

The main issue I'm having is that its not copying the files to the directory stated for target_dir. The upload works fine, the progress bar is great, but I just end up with a folder in the temp directory with the unique ID and a CGItempxxxxx file.

This file, when re-named to the correct file name is the exact file its supposed to be, but the script isn't doing this automatically. The dir paths are correct, with the proper privileges (near as Windows can get), and every other part works...

Another issue is to be able to change the upload dir dynamically based on form data passed to it, but I think I saw a solution to that in another thread.

Any ideas?

User avatar
PilgrimX182
Posts: 2186
Joined: Mar 22, 2006 1:39 pm

#2 Postby PilgrimX182 » Dec 18, 2006 7:23 am

Sure. Damn Windows lock upload temp file, so you should use

Code: Select all

move($temp,"$dir/$fname") || copy($temp,"$dir/$fname") || die"Can't copy file from temp dir";
instead of 'rename($temp,"$dir/$fname");' inside SaveFile2 subroutine.

As far as I remember, this is the cure for windows.

sandyinc
Posts: 7
Joined: Dec 15, 2006 8:30 pm

#3 Postby sandyinc » Dec 18, 2006 3:15 pm

Well, it still doesn't move it to the proper location, but at least nothing else broke...

Since I've already put so much time into this... how much work is required to upgrade to the paid version?

sandyinc
Posts: 7
Joined: Dec 15, 2006 8:30 pm

#4 Postby sandyinc » Dec 18, 2006 9:18 pm

*edit*

Just realized I had the path to perl wrong in the cgi file headers. Duh.

The direct copied upload_form.html works, but returns a "you are not allowed to upload files" error...

*edit-edit*

And after a quick search I found that ip_allowed oddness. Huzzah for the workingness!

sandyinc
Posts: 7
Joined: Dec 15, 2006 8:30 pm

#5 Postby sandyinc » Dec 19, 2006 2:24 pm

New day, new errors: Upon attempting to upload, it appears that nothing happens and I get an error in the browser that says there is a syntax error on character 1 of line 2 (which happens to be the < of the <html> tag). After inspecting the Apache logs, I find this:

Code: Select all

[Tue Dec 19 08:50:04 2006] [error] [client 127.0.0.1] [Tue Dec 19 08:50:04 2006] upload.cgi: Global symbol "@fn" requires explicit package name at C:/Program Files/Apache Group/Apache2/cgi-bin/upload.cgi line 165., referer: http://localhost/PORTAL/file_management.html
[Tue Dec 19 08:50:04 2006] [error] [client 127.0.0.1] [Tue Dec 19 08:50:04 2006] upload.cgi: Global symbol "@fn" requires explicit package name at C:/Program Files/Apache Group/Apache2/cgi-bin/upload.cgi line 167., referer: http://localhost/PORTAL/file_management.html
[Tue Dec 19 08:50:04 2006] [error] [client 127.0.0.1] [Tue Dec 19 08:50:04 2006] upload.cgi: BEGIN not safe after errors--compilation aborted at C:/Program Files/Apache Group/Apache2/cgi-bin/upload.cgi line 369., referer: http://localhost/PORTAL/file_management.html

lines 165 and 167 are in this block:

Code: Select all

if(-e "$c->{target_dir}/$fn.$ext" && $c->{copy_mode} eq 'Rename')
   {
      my $i;
      $i++ while (-e "$c->{target_dir}/$fn[$i].$ext" && $c->{copy_mode} eq 'Rename');      <-165
      $fhash{file_status}="renamed";
      &lmsg("MSG:'$fn.$ext' ".$c->{msg}->{already_exist}." '$fn[$i].$ext'.");       <-167
      $fn.=$i;
   }
and 369 is in:

Code: Select all

sub getRemoteHost
{
   my $ip = shift;
   return $ENV{'REMOTE_HOST'} if $ENV{'REMOTE_HOST'};
   use Socket;     <-369
   return gethostbyaddr(inet_aton($ip), AF_INET);
}
I'm a bit lost on this. How could it error on lines 165 and 167 because of $fn if it uses that same variable in line 162 to get to that part of the script?

Also, I'm getting an error for files that aren't already in the directory, but this is telling me its a problem with the xupload.js file where it doesn't know what ext_allowed is. Maybe its a problem with XUploadConfig.pm ?

It just drives me nuts because it worked great before I went home last night and this morning I get this :x

User avatar
PilgrimX182
Posts: 2186
Joined: Mar 22, 2006 1:39 pm

#6 Postby PilgrimX182 » Dec 20, 2006 6:35 am

Hmm...where did you get this XUpload source? :)
This error happens only when Rename situation happens, just replace "$fn[$i].$ext" with "$fn.$ext" in 2 places there.