figmo: Baby Grace and Lynn (Default)
[personal profile] figmo
For our internal web page I'm trying to do a caption contest. I want the page to have a heading, the photo, the captions, and a place where you can add your own. When you click a button, the caption gets appended to the list of captions.

I tried cannibalizing a guestbook page and perl script, but the POST method somehow couldn't talk to the perl script.

Is there some way I could do it just using HTML and JavaScript?

Gallery!

Date: 2004-05-16 04:43 am (UTC)
From: [identity profile] sdorn.livejournal.com
The php Gallery (http://gallery.menalto.com) software does that, if you ask people to use the "add comments" link as the place to add captions.

Date: 2004-05-16 06:06 am (UTC)
From: [identity profile] aliza250.livejournal.com
Check permissions on your existing setup, if you try to salvage it instead of going with something canned.

Date: 2004-05-17 07:49 am (UTC)
From: [identity profile] figmo.livejournal.com
All the files involved are protected to 777.

Date: 2004-05-16 07:49 am (UTC)
mdlbear: blue fractal bear with text "since 2002" (Default)
From: [personal profile] mdlbear
You have to have something on the server side to receive and store the content of the POST; the simplest I've seen is the (standard) Perl module CGI. (repost to fix missing end tag)

In the form, you need action="[url-of-CGI-script]"(usually it's a relative URL. You can omit it only if the form is generated by a GET of the same script that handles the POST).

The script itself has to have execute permission for the user the server runs under, and that user has to have write permission for the file the comments are going into (and usually the directory, unless you want to start by creating an empty file). The server usually has to be told that it's ok to execute the script; this is usually done by putting it into a directory called cgi-bin. If the script is in the same directory as the data, the server has to be told to handle it as a CGI; most servers do not allow this because it can be a major security hole if done wrong.

You can find a fairly simple example for the use of CGI for uploading here.

Date: 2004-05-17 07:51 am (UTC)
From: [identity profile] figmo.livejournal.com
I don't have write access to the CGI directory, and our sysadmin doesn't think I should need it.

All the files involved are protected to 777.

Any ideas?

Date: 2004-05-17 10:28 am (UTC)
mdlbear: blue fractal bear with text "since 2002" (Default)
From: [personal profile] mdlbear
Find out whether you can run CGIs from whatever directory you're using: if it's Apache, you'll have to add the appropriate magic to .htaccess. The executable had better be protected 755 and owned by you -- allowing the web server to write it would be bad.

Other things being favorable, that might even be the problem: it's possible to set up the server so that it won't run CGIs unless it's reasonably safe.

If you can't run Perl out of your own directory, you'll have to use PHP.

Date: 2004-05-16 09:47 am (UTC)
cellio: (avatar)
From: [personal profile] cellio
Sounds like it could be a permission problem -- execute for the script or write for wherever the comments are going.

Date: 2004-05-17 07:51 am (UTC)
From: [identity profile] figmo.livejournal.com
That's what I thought, which is why I protected all the files to 777. It didn't help.

Date: 2004-05-17 08:29 am (UTC)
cellio: (avatar)
From: [personal profile] cellio
Hmm, that sounds odd. I'll be curious about what the problem turns out to be, if you figure it out.

(Alas, I have no Javascript wisdom to impart for a workaround.)

July 2021

S M T W T F S
    123
45678910
111213 14151617
18192021222324
25262728293031

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 22nd, 2025 02:57 am
Powered by Dreamwidth Studios