Can you add a test category to make sure that isnt the problem.
Feb 15, 2002, 1:19 PM
User (161 posts)
Feb 15, 2002, 1:19 PM
Post #27 of 62
Views: 13845
Paul,
There is a category called Pictures already in place, but I added a category called test if that is what you need.
http://www.carsonscorner.com/pages/index.html
Thanks,
Chris
There is a category called Pictures already in place, but I added a category called test if that is what you need.
http://www.carsonscorner.com/pages/index.html
Thanks,
Chris
Feb 15, 2002, 2:48 PM
User (161 posts)
Feb 15, 2002, 2:48 PM
Post #29 of 62
Views: 13798
The way that page is written (pages/index.html), it is looking to grab the current category - there is no "if statement" that would void that out. If you go to one of the category pages like:
http://www.carsonscorner.com/pages/Pictures/
You can try to add a resource and get the
"Unknown tag: Title" error.
If you know how I can change the password on fileman - I can give you access to that if it would help.
Thanks,
Chris
http://www.carsonscorner.com/pages/Pictures/
You can try to add a resource and get the
"Unknown tag: Title" error.
If you know how I can change the password on fileman - I can give you access to that if it would help.
Thanks,
Chris
Feb 28, 2002, 9:21 AM
Novice (32 posts)
Feb 28, 2002, 9:21 AM
Post #30 of 62
Views: 13856
Its a greats Mod, just what i been looking for. One slight problem though.
This only works for the users add.cgi and modify forms. How do I add the propper field to the administrators add/modify forms.
Im sure is something as simple as adding the new row and form extension to the forms but where in the script are these forms kept.
Also is there a way so that the file gets renamed to what ever the link ID is such as 1.gif or 3.gif etc...
This only works for the users add.cgi and modify forms. How do I add the propper field to the administrators add/modify forms.
Im sure is something as simple as adding the new row and form extension to the forms but where in the script are these forms kept.
Also is there a way so that the file gets renamed to what ever the link ID is such as 1.gif or 3.gif etc...
Feb 28, 2002, 9:46 AM
Veteran (19537 posts)
Feb 28, 2002, 9:46 AM
Post #31 of 62
Views: 13846
Changing the admin page isn't easy. It requires lots of changes to db.pl
It would be better to just name the file manually and upload it using ftp to your images directory and just enter the file name in the admin form.
As for the second question, you can't really name by id as if someone uploads more than one images it will mess up.
It would be better to just name the file manually and upload it using ftp to your images directory and just enter the file name in the admin form.
As for the second question, you can't really name by id as if someone uploads more than one images it will mess up.
Mar 21, 2002, 5:32 AM
New User (2 posts)
Mar 21, 2002, 5:32 AM
Post #32 of 62
Views: 13822
Could someone point me to where this mod is available? I couldn't find it at http://www.wiredon.net/gossamer/mods.shtml
Thanks
Thanks
Apr 21, 2002, 6:53 AM
New User (4 posts)
Apr 21, 2002, 6:53 AM
Post #35 of 62
Views: 13716
excuse me. i saw some one ask the question before, but can you tell me how to name the file name [eg: xx. jpg] as the $ID name?
beause we can add one more field at add.html , something like a drop down meun.
[logo]
[cover]
[default]
then it will able to rename it as..
$ID+logo.jpg or $ID+cover.jpg ... etc
I am looking forward your reply .. Thx
beause we can add one more field at add.html , something like a drop down meun.
[logo]
[cover]
[default]
then it will able to rename it as..
$ID+logo.jpg or $ID+cover.jpg ... etc
I am looking forward your reply .. Thx
Aug 27, 2002, 10:26 AM
Novice (30 posts)
Aug 27, 2002, 10:26 AM
Post #36 of 62
Views: 13649
Problems!
I'm getting the following error when using Add.cgi with the script installed:
CGI ERROR
==========================================
Error Message : Can't open /103046876620028215096163765775228.jpg : Permission denied
Script Location : add.cgi
Perl Version : 5.006001
I've set the directory to 777 and the images upload directory to 777 too. Am I missing something?
my Links.def has:
FilePic1 => [32, 'alpha', 1, 50, 0, '', '^[^\.]+\.(gif|GIF|jpg|JPG)$'],
FilePic2 => [33, 'alpha', 1, 50, 0, '', '^[^\.]+\.(gif|GIF|jpg|JPG)$'],
FilePic3 => [34, 'alpha', 1, 50, 0, '', '^[^\.]+\.(gif|GIF|jpg|JPG)$'],
FilePic4 => [35, 'alpha', 1, 50, 0, '', '^[^\.]+\.(gif|GIF|jpg|JPG)$'],
And I've set $db_file = 32; in the important fields section
I'm getting the following error when using Add.cgi with the script installed:
CGI ERROR
==========================================
Error Message : Can't open /103046876620028215096163765775228.jpg : Permission denied
Script Location : add.cgi
Perl Version : 5.006001
I've set the directory to 777 and the images upload directory to 777 too. Am I missing something?
my Links.def has:
FilePic1 => [32, 'alpha', 1, 50, 0, '', '^[^\.]+\.(gif|GIF|jpg|JPG)$'],
FilePic2 => [33, 'alpha', 1, 50, 0, '', '^[^\.]+\.(gif|GIF|jpg|JPG)$'],
FilePic3 => [34, 'alpha', 1, 50, 0, '', '^[^\.]+\.(gif|GIF|jpg|JPG)$'],
FilePic4 => [35, 'alpha', 1, 50, 0, '', '^[^\.]+\.(gif|GIF|jpg|JPG)$'],
And I've set $db_file = 32; in the important fields section
Aug 28, 2002, 4:41 PM
Novice (30 posts)
Aug 28, 2002, 4:41 PM
Post #39 of 62
Views: 13608
File1 => [32, 'alpha', 1, 50, 0, '', '^(?:|[^\.]+\.(?:gif|GIF|jpg|JPG))$'],
File2 => [33, 'alpha', 1, 50, 0, '', '^(?:|[^\.]+\.(?:gif|GIF|jpg|JPG))$'],
File3 => [34, 'alpha', 1, 50, 0, '', '^(?:|[^\.]+\.(?:gif|GIF|jpg|JPG))$'],
File4 => [35, 'alpha', 1, 50, 0, '', '^(?:|[^\.]+\.(?:gif|GIF|jpg|JPG))$'],
Thanks for replying Paul. I tried that (as above) but the errorFile1 (Invalid format) File2 (Invalid format) File3 (Invalid format) File4 (Invalid format)
Is still coming up when the user doesn't put upload any images....
File2 => [33, 'alpha', 1, 50, 0, '', '^(?:|[^\.]+\.(?:gif|GIF|jpg|JPG))$'],
File3 => [34, 'alpha', 1, 50, 0, '', '^(?:|[^\.]+\.(?:gif|GIF|jpg|JPG))$'],
File4 => [35, 'alpha', 1, 50, 0, '', '^(?:|[^\.]+\.(?:gif|GIF|jpg|JPG))$'],
Thanks for replying Paul. I tried that (as above) but the error
Is still coming up when the user doesn't put upload any images....
Oct 8, 2002, 4:26 PM
User (181 posts)
Oct 8, 2002, 4:26 PM
Post #42 of 62
Views: 13521
I believe that I've come up with a solution to the problem seeker has here. The core of the problem is that the standard html upload field object absolutely CANNOT accept a default value. So if you do the following:
<input name="File3" type="FILE" id="File3" value="image.jpg">
image.jpg will not upload when you submit the form. This means you cannot populate the form with the previosly uploaded resource as follows:
<input name="File3" type="FILE" id="File3" value="<%File3%>">
When you view the source of the form you will see the value of <%File3%> in the form element but it will be removed upon submission of the form.
Similarly it is IMPOSSIBLE to populate the form by cutting and pasting or any sort of Javascript.
So there's the problem. If you want the user to be able to preserve the previosly uploaded photo upon modification you must ask him/her to upload it again. This is a pretty clunky UI to say the least.
I have have 5 file upload fields like seeker and I’m using Paul’s upload mod as well as his password modify mod. I’m pretty sure the things I did will work with upload mod alone.
So basically the way to fix it is to have a hidden form field that passes back and forth the name of any previously uploaded file. By using this, as well as being able to test
if the form field has a new upload in it we can keep the old file, delete the old file and or add the new file.
Here what you need to do:
For each upload field of your modify (modify.html – I’m using templates) page put in a hidden that contains the value of File(x) as follows:
# first, if the user has previously uploaded an image, show it to them:
<%if File1%>
<img src="<%upload_url%>/<%File1%>"><br><br>
<%endif%>
# here’s the upload form field
<input name="File1" type="FILE" value="">
# Here’s the hidden field that holds the file name of the previously uploaded file.
# Note: If no file has previously been uploaded the value field will be empty.
<input type="hidden" name="File1Transfer" value="<%File1%>">
# Do this for each file upload making sure
# that File(x) and File(x)Transfer have the same number for x.
# Next, in modify.cgi replace Paul’s sub parse_me_and_upload with the following.
# Be sure to back up the original sub parse_me_and_upload in
# case this one doesn’t work.
sub parse_me_and_upload {
use CGI qw(:standard);
my (%in);
my ($fnum,$file_field,$file_name,$ext,$bytes_count,$size,$buff);
my ($num)=1;
my ($IN) = new CGI;
# create a hash for all input - name => value
for ($IN->param) { $in{$_} = $IN->param($_) }
# loop through the input
for (keys %in) {
# if the field name matches File(DIGIT) this is a file upload field...
if (/^(File\d*)$/i) {
# establish and number associative files in array
# $in{$file_field} = name of file being uploaded from form.
# $1 = Form element name ie. File1
# Increment the form element counter
$fnum = $num++;
# do some stuff that I've yet to understand.
$file_field = $1;
$in{$file_field} =~ /([^\/\\]+)$/ and $file_name = $1;
# If the File(X) field is empty
if (length($in{$file_field}) < 1 ) {
# just to copy the value of File(X)Transfer
# into $in{$file_field}. This will either be an empty string or
# the previously uploaded filename.
$in{$file_field} = "$in{'File' . $fnum . 'Transfer'}";
# Other wise the File(x) form upload element has something in it.
}else{
# So first remove any previously uploaded files in that file(x) position
if (length($in{'File' . $fnum . 'Transfer'}) > 1) {
unlink "$upload_path/$in{'File' . $fnum . 'Transfer'}";
}
# Now let's go ahead and upload that new file
$rand = sprintf "%05d", rand 1_000_000;
$file_name = $rand . $file_name; # Prevent files being overwritten by giving them a random prefix
open U, ">$upload_path/$file_name" or &cgierr("Can't open $upload_path/$file_name : $!");
binmode U; # needed for Windows servers
while ($bytes_count = read($in{$file_field},$buff,2096)) {
$size += $bytes_count;
print U $buff;
}
close U;
$in{$file_field} = $file_name;
# create an array of upload fields so we can unlink if there's a booboo
push @uploads, $in{$file_field}
}
}
}
# return the %in hash as normal
return %in
}
# Also, in sub process_form change the following
# First make sure the link isn't already in there.
open (MOD, "<$db_modified_name") or &cgierr ("error opening modified database: $db_modified_name. Reason: $!");
while (<MOD>) {
chomp;
@values = split /\|/;
if ($values[0] eq $in{$db_key}) {
close MOD;
&site_html_modify_failure("A request to modify this record has already been received. Please try again later.");
# remove any new uploads.
unlink "$upload_path/$_" foreach @uploads; # <--- New Line Here...
return;
}
}
close MOD;
Well, I think that's it. This all worked for me. Hopefully it works for you too.
ps. if anyone can tell me how to limit the size of a file upload that would be fantastic!
<input name="File3" type="FILE" id="File3" value="image.jpg">
image.jpg will not upload when you submit the form. This means you cannot populate the form with the previosly uploaded resource as follows:
<input name="File3" type="FILE" id="File3" value="<%File3%>">
When you view the source of the form you will see the value of <%File3%> in the form element but it will be removed upon submission of the form.
Similarly it is IMPOSSIBLE to populate the form by cutting and pasting or any sort of Javascript.
So there's the problem. If you want the user to be able to preserve the previosly uploaded photo upon modification you must ask him/her to upload it again. This is a pretty clunky UI to say the least.
I have have 5 file upload fields like seeker and I’m using Paul’s upload mod as well as his password modify mod. I’m pretty sure the things I did will work with upload mod alone.
So basically the way to fix it is to have a hidden form field that passes back and forth the name of any previously uploaded file. By using this, as well as being able to test
if the form field has a new upload in it we can keep the old file, delete the old file and or add the new file.
Here what you need to do:
For each upload field of your modify (modify.html – I’m using templates) page put in a hidden that contains the value of File(x) as follows:
# first, if the user has previously uploaded an image, show it to them:
<%if File1%>
<img src="<%upload_url%>/<%File1%>"><br><br>
<%endif%>
# here’s the upload form field
<input name="File1" type="FILE" value="">
# Here’s the hidden field that holds the file name of the previously uploaded file.
# Note: If no file has previously been uploaded the value field will be empty.
<input type="hidden" name="File1Transfer" value="<%File1%>">
# Do this for each file upload making sure
# that File(x) and File(x)Transfer have the same number for x.
# Next, in modify.cgi replace Paul’s sub parse_me_and_upload with the following.
# Be sure to back up the original sub parse_me_and_upload in
# case this one doesn’t work.
sub parse_me_and_upload {
use CGI qw(:standard);
my (%in);
my ($fnum,$file_field,$file_name,$ext,$bytes_count,$size,$buff);
my ($num)=1;
my ($IN) = new CGI;
# create a hash for all input - name => value
for ($IN->param) { $in{$_} = $IN->param($_) }
# loop through the input
for (keys %in) {
# if the field name matches File(DIGIT) this is a file upload field...
if (/^(File\d*)$/i) {
# establish and number associative files in array
# $in{$file_field} = name of file being uploaded from form.
# $1 = Form element name ie. File1
# Increment the form element counter
$fnum = $num++;
# do some stuff that I've yet to understand.
$file_field = $1;
$in{$file_field} =~ /([^\/\\]+)$/ and $file_name = $1;
# If the File(X) field is empty
if (length($in{$file_field}) < 1 ) {
# just to copy the value of File(X)Transfer
# into $in{$file_field}. This will either be an empty string or
# the previously uploaded filename.
$in{$file_field} = "$in{'File' . $fnum . 'Transfer'}";
# Other wise the File(x) form upload element has something in it.
}else{
# So first remove any previously uploaded files in that file(x) position
if (length($in{'File' . $fnum . 'Transfer'}) > 1) {
unlink "$upload_path/$in{'File' . $fnum . 'Transfer'}";
}
# Now let's go ahead and upload that new file
$rand = sprintf "%05d", rand 1_000_000;
$file_name = $rand . $file_name; # Prevent files being overwritten by giving them a random prefix
open U, ">$upload_path/$file_name" or &cgierr("Can't open $upload_path/$file_name : $!");
binmode U; # needed for Windows servers
while ($bytes_count = read($in{$file_field},$buff,2096)) {
$size += $bytes_count;
print U $buff;
}
close U;
$in{$file_field} = $file_name;
# create an array of upload fields so we can unlink if there's a booboo
push @uploads, $in{$file_field}
}
}
}
# return the %in hash as normal
return %in
}
# Also, in sub process_form change the following
# First make sure the link isn't already in there.
open (MOD, "<$db_modified_name") or &cgierr ("error opening modified database: $db_modified_name. Reason: $!");
while (<MOD>) {
chomp;
@values = split /\|/;
if ($values[0] eq $in{$db_key}) {
close MOD;
&site_html_modify_failure("A request to modify this record has already been received. Please try again later.");
# remove any new uploads.
unlink "$upload_path/$_" foreach @uploads; # <--- New Line Here...
return;
}
}
close MOD;
Well, I think that's it. This all worked for me. Hopefully it works for you too.
ps. if anyone can tell me how to limit the size of a file upload that would be fantastic!
Oct 10, 2002, 9:55 PM
New User (3 posts)
Oct 10, 2002, 9:55 PM
Post #43 of 62
Views: 13468
I am having the same problem
http://www.drpic.com/links/
Unkown Tag: Title
or when modifying:
Unkown Tag: Current URL
http://www.drpic.com/links/
Unkown Tag: Title
or when modifying:
Unkown Tag: Current URL
Nov 23, 2002, 4:15 PM
Enthusiast (832 posts)
Nov 23, 2002, 4:15 PM
Post #47 of 62
Views: 13393
Paul,
I am trying this mod. All works well and I have changed the regex per your last post. However, there is one problem - when the user does not upload any file, it still writes numbers like "1032039745" in the upload directory. Since I am linking to the image directly in the detailed page, if nothing is loaded a broken link shows up because of those numbers.
Any idea how to fix this problem?
Also:
1. Is there a way to limit the size of the upload?
2. Is there a way to delete the image(s) from the upload when admin deletes a correponding link?
Other than those minor issues, this is a nice mod.
thanks
Also, thanks to swaylock - your idea is working well.
I am trying this mod. All works well and I have changed the regex per your last post. However, there is one problem - when the user does not upload any file, it still writes numbers like "1032039745" in the upload directory. Since I am linking to the image directly in the detailed page, if nothing is loaded a broken link shows up because of those numbers.
Any idea how to fix this problem?
Also:
1. Is there a way to limit the size of the upload?
2. Is there a way to delete the image(s) from the upload when admin deletes a correponding link?
Other than those minor issues, this is a nice mod.
thanks
Also, thanks to swaylock - your idea is working well.
Feb 18, 2003, 12:55 AM
Novice (44 posts)
Feb 18, 2003, 12:55 AM
Post #50 of 62
Views: 13364
Hi Paul,
Firstly, thanks for making your upload mod available, which I am personally interested in using. Unfortunately, it appears as if the link isn't working: http://www.wiredon.net/gt/download.shtml , please can you confirm this.
Thanks
Hamsterpants
Firstly, thanks for making your upload mod available, which I am personally interested in using. Unfortunately, it appears as if the link isn't working: http://www.wiredon.net/gt/download.shtml , please can you confirm this.
Thanks
Hamsterpants