View Single Post
Old 03-06-2005, 04:42 AM  
jovigirl
Confirmed User
 
jovigirl's Avatar
 
Join Date: Apr 2003
Location: On the edge
Posts: 1,796
I need a small cgi tweak - txt importing

Basically I have a script that allows me to import data pasting it directly into the browser window or uploading a file thru the browser.
Problem is files are too big and the browser times out.
So I would like to upload the file via ftp and make the script read the file directly from the server.

How can I add an else option that checks if a file located at /path/new.txt exists ?
The code I am using right now is like this:

if(SCRIPT::App::Guts::strip($q->param("new_data")) ne ""){
$new_data= $q->param("new_data");
}else{
if($data_file){
my $new_file = file_upload('new_data_file');
open(UPLOADED, "$new_file") or die $!;
{
local $/ = undef;
$new_data= <UPLOADED>;
}
close(UPLOADED);
unlink($new_file) or warn "could not remove uploaded data, '$new_file': $!";
}
}


Thanks

__________________
ICQ :333-548-380
jovigirl is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote