| View previous topic :: View next topic |
| Author |
Message |
sandyinc
Joined: 15 Dec 2006 Posts: 7
|
Posted: Dec 15, 2006 8:49 pm Post subject: Files not copying |
|
|
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? |
|
| Back to top |
|
 |
PilgrimX182

Joined: 22 Mar 2006 Posts: 1107 Location: Undisclosed location
|
Posted: Dec 18, 2006 7:23 am Post subject: |
|
|
Sure. Damn Windows lock upload temp file, so you should use
| Code: | | 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. |
|
| Back to top |
|
 |
sandyinc
Joined: 15 Dec 2006 Posts: 7
|
Posted: Dec 18, 2006 3:15 pm Post subject: |
|
|
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? |
|
| Back to top |
|
 |
sandyinc
Joined: 15 Dec 2006 Posts: 7
|
Posted: Dec 18, 2006 9:18 pm Post subject: |
|
|
*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! |
|
| Back to top |
|
 |
sandyinc
Joined: 15 Dec 2006 Posts: 7
|
Posted: Dec 19, 2006 2:24 pm Post subject: |
|
|
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: | [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: | 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: | 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  |
|
| Back to top |
|
 |
PilgrimX182

Joined: 22 Mar 2006 Posts: 1107 Location: Undisclosed location
|
Posted: Dec 20, 2006 6:35 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
|