|
Post by buppie on Mar 17, 2007 8:33:11 GMT -5
Maybe it's possible to make a separate directory for uploaded images instead of the archives/entry's directory. This for a better overview. I have 2000 entry's already and also more as 2500 images in the same directory. It's a little bit chaos.
|
|
|
Post by Carlos Phelps on Mar 17, 2007 13:50:36 GMT -5
Buppie, I have a three line mod that will let you change your upload directory, but you will need to edit the gm-upload.cgi file. Please use a program like Notepad or Notepad++ to do this change. But first add the new directory in your archives/entry's directory so you will have something like this: mysite.com/archives/upload/
chmod the new directory to 777 ***** (Note This is what GM asked for, but was able to get it to work with 774) Next open gm-upload.cgi and find line 107 it should look like this if (-e "$EntriesPath/$uploadfilename") {
Just before this line add these lines #### Start of Add to change upload directory March 17, 2007 my $EntriesPath = "$main::EntriesPath/upload"; #### End of Add to change upload directory
Save the file then ftp it in text mode to your website and you should be set. Enjoy, Carlos
|
|
|
Post by petefinnigan on Mar 17, 2007 16:30:54 GMT -5
Hi Carlos,
Thanks for the mod, it will also be useful for the security issue reported on gm-upload.
Have you tested this mod? - the reason I ask is that I am not familiar with the "main::" syntax, what does this do? - does it modifiy the original variable?
If it doesnt then you would also need to modifiy the write statement at line 115 and potentially anywhere else the directory/filename are used.
cheers
Pete
|
|
|
Post by Carlos Phelps on Mar 17, 2007 18:23:50 GMT -5
Pete, Yes I tested it, to make sure it would upload a file to the new directory. What the line my $EntriesPath = "$main::EntriesPath/upload";
does for us: - Get the value of $EntriesPath in the main package
(i.e. the calling program namespace) with use of $main::EntriesPath
- Adds /upload to the path with the use of the double quotes
- Places the new value in the new $EntriesPath with the use =
- Make the new $EntriesPath local with the use of my
So the next step I think would be to add to the admin panel to make it a setting. Side note: Since $EntriesPath was in the main package we could use a null package instead of $main::EntriesPath we would get $::EntriesPath Hi Carlos, Thanks for the mod, it will also be useful for the security issue reported on gm-upload. Have you tested this mod? - the reason I ask is that I am not familiar with the "main::" syntax, what does this do? - does it modifiy the original variable? If it doesnt then you would also need to modifiy the write statement at line 115 and potentially anywhere else the directory/filename are used. cheers Pete
|
|
|
Post by petefinnigan on Mar 19, 2007 8:09:51 GMT -5
Hi Carlos,
Thanks very much for the explanation of this syntax, i was not aware of this, it seems quite useful.
I agree that going forwrad we need to be able to chnage the upload directory and to also disable gm-upload completely if required. This could be done by a simple check in gm-upload first before it does any other work.
cheers
Pete
|
|
|
Post by coldstone on Mar 19, 2007 12:02:02 GMT -5
I can't wait till all the variables are properly localized, as I found out from bitter experience this weekend, its very hard to tell what changing a var to 'my' can do.
|
|