Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Previewing With Local Image Links

by moodster (Hermit)
on Feb 04, 2002 at 08:46 UTC ( [id://143183]=note: print w/replies, xml ) Need Help??


in reply to Previewing With Local Image Links

Ok, let's see if I understand the concept: the idea is that while previewing, the image is kept locally on the client computer and it's only after actually submitting it using CGI->upload() that it gets uploaded to the server?

I think it might be possible to get this to work using some heavy JavaScript wizardry to snatch the file name from the upload control and modifying the the HTTP request that gets sent to the server so that the file doesn't get uploaded, but the filename does. It's been several years since I did JS stuff however, so don't take my word for it.

If on the other hand your relying solely on CGI.pm and no client-side scripting, I'd say that it wouldn't work. The file path/name using CGI->upload() is not the path to the file on the client, so you wouldn't be able to use that. You could do it by letting your users hand-type the path into a text box and using that input to build the preview page, but that's not really user-friendly.

Cheers,
-- moodster

Replies are listed 'Best First'.
Re: Re: Previewing With Local Image Links
by Cody Pendant (Prior) on Feb 04, 2002 at 10:24 UTC
    The file path/name using CGI->upload() is not the path to the file on the client
    Isn't it? I think that's exactly what it is. There's a post on the front page right now saying "why am I getting the filepath on the client when using CGI.pm to upload?"

    --
    Weaselling out of things is important. It's what separates us from the animals ... except the weasel.

      Mea Culpa.

      After actually reading the CGI.pm perldoc I discovered that I was wrong. But only partially wrong. The documentation also mentions that not all browsers send the whole path; some send only the file name. So you can't rely on the path that gets submitted to preview images anyway (well, not in a browser-independent way, that is).

      Cheers,
      -- moodster

        Actually you're right about the file name/path problem. Mac browsers seem only to have the filename, and I don't know how that works, come to think of it.

        Plus, as Mac file paths and names are quite happy to have slashes in them, any script that strips out everything up to the last slash is going to cause errors. Anyone want to look in CGI.pm to see how it does this?

        I've got an idea, how about this:

        • you have your content management system include a frame, to which your users can drag the image in question.
        • Now JavaScript knows the current URL of that frame,
        • You do some kind of smart JavaScript submit to your perl script that will include that URL.
        Happy to help with the JavaScript.

        --

        ($_=
        
        
        '      jjjjjjuuuuuuuuusssssssssttttttttt
               annnnnnoootttttthhhhheeeeeerrrrrr
               pppeeeerrrrrrrrrrrrllllllllllllll
               haaaaccccccckkkkkkkeeeeeeeerrrrrr
        '      )
        
        =~y
               /[a-z]//s
               ;print;
        

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://143183]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-24 19:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found