Gossamer Forum
Home : Products : DBMan SQL : Discussion :

File upload

Quote Reply
File upload
Has anyone sucessfully transfered the multiple file upload mod to dbmansql?

I am getting: Illegal division by zero at db.cgi line 1342
Line 1342 is bold

$newdirname = $in{$db_key};
if (!(-e $SAVE_DIRECTORY/$newdirname)) {
$dirsuccess = mkdir "$SAVE_DIRECTORY/$newdirname", 0777;
else {
opendir (GRAPHIC, $SAVE_DIRECTORY/$newdirname) or &cgierr("unable to open directory. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
foreach $file (@files) {
next if ($file =~ /^\./); # Skip "." and ".." entries..
next if ($file =~ /^index/); # Skip index.htm type files..
@stats = stat "$SAVE_DIRECTORY/$newdirname/$file";
$prev_bytes =$stats[7];
Quote Reply
Re: File upload In reply to
I managed to do the single file upload sucessfully:
In sub add_record
if (($status eq "ok") && ($in{'Filename'})) { $status = &validate_upload; } #Validate Picture
foreach $name (@db_cols) {
next if ($in{$name} =~ /^\s*$/);
$insert_name .= "$name,";
$db_is_int{$name} ?
($insert_value .= int($in{$name}) . ",") :
($insert_value .= $DBH->quote($in{$name}) . ",");
chop ($insert_name); chop ($insert_value); # Remove trailing delimiters.

$query = qq!
INSERT INTO $db_table ($insert_name)
VALUES ($insert_value)

in sub modify_record
my ($status, $line, @lines, @data, $output, $found, $restricted);
my ($status, $line, @lines, $id, @rest, $output, $found, $userid_q, $key_q);

add if (($status eq "ok") && ($in{'Filename'})) { $status = &validate_upload; } # Validate Picture
$status = &validate_record; # Check to make sure the modifications are ok!

All other modifications as per http://www.jpdeni.com/dbman/Mods/file_upload2.txt

I also have the multi upload working except that it will upload more than the $MAXIMUM_UPLOAD set.

Quote Reply
Re: File upload In reply to
Can you show how it work with multi upload ??