Gossamer Forum
Home : Products : DBMan : Customization :

File Upload Mod Implementation

Quote Reply
File Upload Mod Implementation
Hi! I have been trying to install the File Upload Mod of DBMan as a creative solution for a Classified Ads script. I have come to somewhat of an impass. I must admit my Perl knowledge is more or less superficial. At the moment, submitting a file to upload with a record returns "Unknown Action". There is also an error occuring when one tries to modify a record. Ideally, I would like to set it up so Record Owners can only modify/delete their own records, and anyone can view/search ads.

You can find my implementation of the script at http://www.allsportsrv.com/cgi-bin/classifieds/db.cgi . I have also made the "db.cgi", "default.cfg", and "html.pl" into text files (residing in the same directory as the script). All three have had their extensions changed to .txt. Any input regarding this matter would be greatly appreciated. Thanks in advance!



------------------
Regards,

Pat Dupuis
Quote Reply
Re: File Upload Mod Implementation In reply to
I've left the permissions this way, only temporarily, until I got the rest of the mechanics in order. :-)

I'll have the proper default.cfg file up for you in a jiffy.



------------------
Regards,

Pat Dupuis
Quote Reply
Re: File Upload Mod Implementation In reply to
I was unable to view your files, probably because they are in the cgi-bin. You'll need to move them to a web-accessible directory -- one where you would place html files.

Does the file successfully upload? If so, look to your db.cgi file and make sure you added the line

Code:
elsif ($in{'upload_success'}) { &html_upload_success; }

That's the only thing I can think of without seeing your files.


------------------
JPD





Quote Reply
Re: File Upload Mod Implementation In reply to
Hi JP!

Thanks so much for the quick response. My appologies on the txt files. They've been moved to the following directory: http://www.allsportsrv.com/view/ . In response to your query, I did add the elsif statement to the db.cgi file. However, it does not completely upload successfully. A new image file does appear in the upload directory, but it's -1 bytes and does not actually pull up when viewing the record.



------------------
Regards,

Pat Dupuis
Quote Reply
Re: File Upload Mod Implementation In reply to
Since your files are not uploading properly, I'd like you to do a little experiment for me. Go to
http://www.terminalp.com/...ts/file_upload.shtml
and pick up the original file upload script that I used for the mod. Install it on your system and see if it works for you. Let's just make sure that the underlying process works on your server. Smile


------------------
JPD





Quote Reply
Re: File Upload Mod Implementation In reply to
I just configured, installed, and tested the upload script in a stand-alone setup and it works A-OK.



------------------
Regards,

Pat Dupuis
Quote Reply
Re: File Upload Mod Implementation In reply to
Okay. Good. (Well, sorta. That means there's a problem in my script. Smile )

The file you posted for your default.cfg file is the one that comes with the distribution. I need to see the actual one you're using.

If your files are being saved in the correct directory, but just aren't being uploaded, then I guess the problem is within the file-upload script itself.

Let me take a look at my copy of the script, since you wouldn't have made any changes to it. There could be something in your configuration, though, so I will need to see your working default.cfg file.

BTW, I added a record to your database to test it out, but I deleted it. You might think about changing your permissions. You've left yourself open for some real potential problems.


------------------
JPD





Quote Reply
Re: File Upload Mod Implementation In reply to
Thanx JP Smile

I greatly appreciate your help and guidance. I'll be waiting for any further instructions. Smile



------------------
Regards,

Pat Dupuis
Quote Reply
Re: File Upload Mod Implementation In reply to
The book on CGI.pm is down at my apartment manager's office. (The dumb UPS guy didn't bother to ring the doorbell, but must have just tapped gently on the door and I didn't hear him! Frown ) As soon as I get myself together to go down there, I'll pick it up. I may very well rewrite the whole thing, once I know how it it works. Smile


------------------
JPD





Quote Reply
Re: File Upload Mod Implementation In reply to
Hi JP.

I've had the proper default.cfg file posted at http://www.allsportsrv.com/view/default.txt .
However, I do have another question concerning authorization. If I want to allow record owners to modify/delete only their OWN records, would I need to create a "user_id" field and point the "auth_user_field" variable to it?



------------------
Regards,

Pat Dupuis
Quote Reply
Re: File Upload Mod Implementation In reply to
Pat, I haven't been able to figure out what's wrong with your file upload as yet. I'm working on it, though.

In answer to your other question, yes, you will need to add a userid field and set the $auth_user_field to match it if you want users to be able to modify or delete only their own records.


------------------
JPD





Quote Reply
Re: File Upload Mod Implementation In reply to
Hi JPD!

It's been a while since the last post to this thread. I just thought I would check in with you to see if you may have figured out why the script is returning "Error: Unknown Action" after attempting to upload an image with a record.

We've tested the upload.cgi script in a stand-alone environment, and it works. And CGI.pm is installed on the system. Permissions to the upload directory are chmod 777. Is there anything else I may have overlooked? Is there a specific line I should be adding "elsif ($in{'upload_success'}) { &html_upload_success; }" to in the Main subroutine?

BTW - I appreciate all the help you've been thus far. Smile



------------------
Regards,

Pat Dupuis