Greetings, again!
I'm having a very peculiar problem with the upload mods. Let me explain:
1. I need to allow users to upload 2 images. One to be placed on top of the database (user's photograph) and 1 at the bottom (for one of the user's works).
2. The one at the top will be resized to a standar stamp size (like 100 px by 100 px) but the other will be shown as is, at the bottom of the page.
3. I tried using the multi upload mod, but when I do that I lose the control and placement of the first image.(user's photo).
4. What I am trying right now is a simple modification on the "single image upload" mod, thus simply duplicating the fields and renaming the folder for the second image. I am, however, having a real tough time in doing it. If someone is willing to give me a hand, I would most certainly appreciate it! The code is at the bottom of this message.
Thanks in advance,
Luis
------------------ default.cfg:
Filename => [16,'alpha',0,100,0,'',''],
Filename2 => [17,'alpha',0,100,0,'',''],
and
# File upload parameters
# --------------------------------------------------------
#
# File uploads -- if you want to be able to upload files, set this to 1
$db_upload = 1;
# Full path to directory for uploaded files -- NOT A URL!!!! No trailing slash please.
$SAVE_DIRECTORY = "/home/sites/site27/web/images/members";
# Full URL to directory for uploaded files. No trailing slash please.
$SAVE_DIRECTORY_URL = "http://www.paxbrasilis.com/images/members";
# Defines the number of bytes that can be uploaded. Files that exceed
# this limit will not be saved on the server. Set this to zero in order to
# disable size checking.
$MAXIMUM_UPLOAD = 100000;
# List of allowable file extensions. If the file does not have one of the extensions
# listed, it will not be saved to the server. The format for the setting is
# \.[extension]$ If you want to allow more than one extension, separate the options by
# a | character.
$ALLOWED_EXT = '\.gif$|\.jpg|$|\.jpeg';
# Full path to directory for uploaded files -- NOT A URL!!!! No trailing slash please.
$SAVE_DIRECTORYB = "/home/sites/site27/web/images/members/pics";
# Full URL to directory for uploaded files. No trailing slash please.
$SAVE_DIRECTORY_URLB = "http://www.paxbrasilis.com/images/members/pics";
# List of allowable file extensions. If the file does not have one of the extensions
# listed, it will not be saved to the server. The format for the setting is
# \.[extension]$ If you want to allow more than one extension, separate the options by
# a | character.
$ALLOWED_EXT = '\.gif$|\.jpg|$|\.jpeg';
at the bottom....
------------------ html.pl:
<TR>
<td align="Right" valign="top" width="120">
|; # to close off a previous print qq| statement
opendir (GRAPHIC, "$SAVE_DIRECTORY") or &cgierr("unable to open directory in delete records: $SAVE_DIRECTORY. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
$file_test = $rec{$db_key};
foreach $file (@files) {
if ($file =~ /^$file_test\./) {
print qq|<align=left><img src= "$SAVE_DIRECTORY_URL/$file" width=100 height=100
border=2></align>|;
$graphic_found=1;
}
}
print qq|
|;
unless ($graphic_found) {
print qq|<img src="../../images/members/default.gif">|;
}
print qq|
</td>
<TR>
<td align="Right" valign="top" width="120">
|;
# to close off a previous print qq| statement
opendir (GRAPHIC, "$SAVE_DIRECTORYB") or &cgierr("unable to open directory in delete records: $SAVE_DIRECTORYB. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
$file_test = $rec{$db_key};
foreach $file (@files) {
if ($file =~ /^$file_test\./) {
print qq|<align=left><img src= "$SAVE_DIRECTORY_URLB/$file"></align>|;
$graphic_found=1;
}
}
print qq|
</td>
I'm having a very peculiar problem with the upload mods. Let me explain:
1. I need to allow users to upload 2 images. One to be placed on top of the database (user's photograph) and 1 at the bottom (for one of the user's works).
2. The one at the top will be resized to a standar stamp size (like 100 px by 100 px) but the other will be shown as is, at the bottom of the page.
3. I tried using the multi upload mod, but when I do that I lose the control and placement of the first image.(user's photo).
4. What I am trying right now is a simple modification on the "single image upload" mod, thus simply duplicating the fields and renaming the folder for the second image. I am, however, having a real tough time in doing it. If someone is willing to give me a hand, I would most certainly appreciate it! The code is at the bottom of this message.
Thanks in advance,
Luis
------------------ default.cfg:
Filename => [16,'alpha',0,100,0,'',''],
Filename2 => [17,'alpha',0,100,0,'',''],
and
# File upload parameters
# --------------------------------------------------------
#
# File uploads -- if you want to be able to upload files, set this to 1
$db_upload = 1;
# Full path to directory for uploaded files -- NOT A URL!!!! No trailing slash please.
$SAVE_DIRECTORY = "/home/sites/site27/web/images/members";
# Full URL to directory for uploaded files. No trailing slash please.
$SAVE_DIRECTORY_URL = "http://www.paxbrasilis.com/images/members";
# Defines the number of bytes that can be uploaded. Files that exceed
# this limit will not be saved on the server. Set this to zero in order to
# disable size checking.
$MAXIMUM_UPLOAD = 100000;
# List of allowable file extensions. If the file does not have one of the extensions
# listed, it will not be saved to the server. The format for the setting is
# \.[extension]$ If you want to allow more than one extension, separate the options by
# a | character.
$ALLOWED_EXT = '\.gif$|\.jpg|$|\.jpeg';
# Full path to directory for uploaded files -- NOT A URL!!!! No trailing slash please.
$SAVE_DIRECTORYB = "/home/sites/site27/web/images/members/pics";
# Full URL to directory for uploaded files. No trailing slash please.
$SAVE_DIRECTORY_URLB = "http://www.paxbrasilis.com/images/members/pics";
# List of allowable file extensions. If the file does not have one of the extensions
# listed, it will not be saved to the server. The format for the setting is
# \.[extension]$ If you want to allow more than one extension, separate the options by
# a | character.
$ALLOWED_EXT = '\.gif$|\.jpg|$|\.jpeg';
at the bottom....
------------------ html.pl:
<TR>
<td align="Right" valign="top" width="120">
|; # to close off a previous print qq| statement
opendir (GRAPHIC, "$SAVE_DIRECTORY") or &cgierr("unable to open directory in delete records: $SAVE_DIRECTORY. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
$file_test = $rec{$db_key};
foreach $file (@files) {
if ($file =~ /^$file_test\./) {
print qq|<align=left><img src= "$SAVE_DIRECTORY_URL/$file" width=100 height=100
border=2></align>|;
$graphic_found=1;
}
}
print qq|
|;
unless ($graphic_found) {
print qq|<img src="../../images/members/default.gif">|;
}
print qq|
</td>
<TR>
<td align="Right" valign="top" width="120">
|;
# to close off a previous print qq| statement
opendir (GRAPHIC, "$SAVE_DIRECTORYB") or &cgierr("unable to open directory in delete records: $SAVE_DIRECTORYB. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
$file_test = $rec{$db_key};
foreach $file (@files) {
if ($file =~ /^$file_test\./) {
print qq|<align=left><img src= "$SAVE_DIRECTORY_URLB/$file"></align>|;
$graphic_found=1;
}
}
print qq|
</td>