Gossamer Forum
Home : Products : DBMan : Customization :

Multiple File Upload Mod - Recent Version

Quote Reply
Multiple File Upload Mod - Recent Version
Hi All,

Just installed file upload mod allowing 5 images per record all works well until modify if you want to add more images or change existing ones simply returns following error on submit



Error Message : unable to open directory. Reason: No such file or directory
Script Location : db.cgi
Perl Version : 5.006001
Setup File : default.cfg


All directories and files are in there correct places and i have checked paths over and over again. Is this a common problem?

Any help with this would be much appreciated
Quote Reply
Re: [jamesamorris] Multiple File Upload Mod - Recent Version In reply to
Please check the FAQ noted below under the category "Images" to be sure you have the latest fixes to the upload mod.

It could just be a matter of having quotes around the directory path statement.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Multiple File Upload Mod - Recent Version In reply to
Thanx for reply to my query Lois have been backward and forwards through the code and still cant find why it keeps responding with cant find directory when you want to add further pictures during edit I am at a total loss i have pasted the code from sub_html_record_form as I assume this is where the fault is likely to lie.

Any ideas much appreciated or ill simply have to remove the edit facility.

Thanx again for your help




|;
if ($form_upload_add) {
print qq|<tr><td colspan=2><center><$font_color>You may attach up to $MAXIMUM_FILES photos to this diary entry.</font></center></td></tr>|;
for ($u=1;$u<=$MAXIMUM_FILES ;++$u) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="115"><$font_color>Add Photo:</font></td>
<TD VALIGN="TOP" WIDTH="520">&nbsp;<INPUT TYPE="FILE" NAME="file-to-upload-$u" SIZE="50"></TD></TR>|;
}
}
if ($form_upload_mod) {
if ( -e "$SAVE_DIRECTORY/$rec{$db_key}") {
opendir (GRAPHIC, "$SAVE_DIRECTORY/$rec{$db_key}") or &cgierr("unable to open directory: $SAVE_DIRECTORY/$rec{$db_key}. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
foreach $file (@files) {
next if ($file =~ /^\./); # Skip "." and ".." entries..
next if ($file =~ /^index/); # Skip index.htm type files..
++$num_files;
@stats = stat "$SAVE_DIRECTORY/$rec{$db_key}/$file";
$prev_bytes +=$stats[7];
}
foreach $file (@files) {
next if ($file =~ /^\./); # Skip "." and ".." entries..
next if ($file =~ /^index/); # Skip index.htm type files..
print qq|<tr><td>Delete file
<input type="checkbox" name="$file" value="delete"></td>
<td><img src= "$SAVE_DIRECTORY_URL/$rec{$db_key}/$file"></td></tr>|;
}
}
$new_files=$MAXIMUM_FILES - $num_files;
$new_bytes=$MAXIMUM_UPLOAD - $prev_bytes;
print qq|<tr><td colspan=2>You currently have $num_files files associated with this record, for a
total of $prev_bytes bytes. You may upload up to $new_files additional files, with a total byte
size of $new_bytes bytes.</td></tr>|;
for ($u=1;$u<=$new_files ;++$u) {
print qq|
<TR><TD>Browse Picture:</TD>
<TD><INPUT TYPE="FILE" NAME="file-to-upload-$u" SIZE="50"></TD></TR>|;
}
}
print qq|


</TABLE>
|;
}
Quote Reply
Re: [jamesamorris] Multiple File Upload Mod - Recent Version In reply to
Hello,

I had the same problem when I was installing this multiple file upload. It took me 3 installations before I got it working.

I found the answer from LoisC's Unofficial Dbman's FAQ. Here is the fix.

Quoted

---------------------

You may also need to change the following in sub validate_upload:

opendir (GRAPHIC, $SAVE_DIRECTORY/$newdirname) or &cgierr(''Unable to open directory. Reason: $!'');

add quotes around directory:

opendir (GRAPHIC, ''$SAVE_DIRECTORY/$newdirname'') or &cgierr(''Unable to open directory. Reason: $!'');

-------------

The above fix was from the following threads

http://gossamer-threads.com/p/93484
Also: http://gossamer-threads.com/p/130173

Please check out LoisC's DBMAN'S UNOFFICIAL FAQ . The address is

http://webmagic.hypermart.net/...bfaq.cgi?db=dbmanfaq
Quote Reply
Re: [mikan] Multiple File Upload Mod - Recent Version In reply to
Thankyou!!

Problem seems to be solved now.