Hi, I was using ^|.*\.(?i:gif|jpg|png)$ until I found out that any file type could be uploaded so I emailed support and Jack gave me ^([%\w-]+\.(?:jpe?g|JPE?G|gif|GIF|png|PNG)|)$ which works fine. I am finding most of my users are uploading files like 1a 2b.jpg and the gap/whitespace is giving them a error, how would I modify the above so that only images can be uploaded but the image can have any character in the filename including white space?
Jul 28, 2005, 11:14 AM
Veteran / Moderator (18436 posts)
Jul 28, 2005, 11:14 AM
Post #2 of 8
Views: 2746
Hi,
Why would you *want* whitespace? Trust me, its a lot of grief, when people could just change it for an _ , or similar
I'd personally suggest just leaving it "as-is"
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Why would you *want* whitespace? Trust me, its a lot of grief, when people could just change it for an _ , or similar

I'd personally suggest just leaving it "as-is"

Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Jul 28, 2005, 11:35 AM
User (69 posts)
Jul 28, 2005, 11:35 AM
Post #3 of 8
Views: 2738
Yeah I know ifs grief, when someone adds a site I manually change the filename myself to remove the whitespace. It's just that the majority of people adding there sites are small time B&B owners who arn't computer literate (one person uploaded a .doc file :/). So at the moment I want to make it as easy as possible for them to add their sites. Once my database builds up I will force them to change the filename. Any ideas on the regex?
Aug 4, 2005, 12:00 AM
Veteran / Moderator (18436 posts)
Aug 4, 2005, 12:00 AM
Post #4 of 8
Views: 2738
Ah, fair enough. You could try;
^([%\w\s-]+\.(?:jpe?g|JPE?G|gif|GIF|png|PNG)|)$
Hope that helps.
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
^([%\w\s-]+\.(?:jpe?g|JPE?G|gif|GIF|png|PNG)|)$
Hope that helps.
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Oct 7, 2005, 11:11 PM
Enthusiast (901 posts)
Oct 7, 2005, 11:11 PM
Post #5 of 8
Views: 2694
GSQL still saves files with the original filename. Why? There should be a way to save pics only with the ID and the extension or if you have more than one file with something like ID-Columname.Extension.
I think this should be a snap if someone knows where to change the script ... im still searching for the right place. ;-(
Have someone done this before?
BTW: Using regex: If you think your users are too stupid (i think so), it makes no sense to get on thier nerves with a lot of error-messages, so the add.cgi should take everything and rename it to something you can use without problems.
I think this should be a snap if someone knows where to change the script ... im still searching for the right place. ;-(
Have someone done this before?
BTW: Using regex: If you think your users are too stupid (i think so), it makes no sense to get on thier nerves with a lot of error-messages, so the add.cgi should take everything and rename it to something you can use without problems.
Oct 8, 2005, 12:58 AM
Veteran / Moderator (18436 posts)
Oct 8, 2005, 12:58 AM
Post #6 of 8
Views: 2700
Hi,
True (and that is how some of my custom upload routines work, using GT::CGI). However, GT::SQL::File seems adamant to use the ID-name.ext format, which as you say.. can be a REAL pain sometimes.
Maybe something for GT to consider in the next version? =)
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
True (and that is how some of my custom upload routines work, using GT::CGI). However, GT::SQL::File seems adamant to use the ID-name.ext format, which as you say.. can be a REAL pain sometimes.
Maybe something for GT to consider in the next version? =)
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Oct 8, 2005, 4:17 AM
Enthusiast (901 posts)
Oct 8, 2005, 4:17 AM
Post #7 of 8
Views: 2686
Unfortunalety i do my things normaly only in php, so i cant "speak" perl very well.
But i hope you could take a look into the scripts; everything we need is to find the right place
to change a variable.
Normaly it should go:
upload to temp
remember filename
***
insert link
copy to path/id-filename
insert filename into links_files
But it should be:
upload to temp
insert into links
remember filename, id
get extension (by mime not by filename)
get foreigncolname
copy to path/id-foreigncolname.extension
insert into links_files
Think this is no secret if someone could read this perl-stuff,
in php it would be a thing of minutes.
May you find this little time for us, please?
I really hate it to build and have to watch all data, remeber the id,
download, upload ...
But i hope you could take a look into the scripts; everything we need is to find the right place
to change a variable.
Normaly it should go:
upload to temp
remember filename
***
insert link
copy to path/id-filename
insert filename into links_files
But it should be:
upload to temp
insert into links
remember filename, id
get extension (by mime not by filename)
get foreigncolname
copy to path/id-foreigncolname.extension
insert into links_files
Think this is no secret if someone could read this perl-stuff,
in php it would be a thing of minutes.
May you find this little time for us, please?
I really hate it to build and have to watch all data, remeber the id,
download, upload ...
Oct 10, 2005, 11:11 AM
User (324 posts)
Oct 10, 2005, 11:11 AM
Post #8 of 8
Views: 2667
Here's my two bits.
I would prefer if GT kept the filename as we upload it. At most they should convert wierd characters to _, but it's important to keep the file names in tact so that our images can continue to come up under google images which does look at the filenames for search results.
The only problem that can't be worked around is when deleting a filename that contains spaces. The system doesn't delete those files, and that's a GT bug.
peace.
I would prefer if GT kept the filename as we upload it. At most they should convert wierd characters to _, but it's important to keep the file names in tact so that our images can continue to come up under google images which does look at the filenames for search results.
The only problem that can't be worked around is when deleting a filename that contains spaces. The system doesn't delete those files, and that's a GT bug.
peace.