Results 1 to 3 of 3

Thread: Showing AND downloading a picture in one link

  1. #1
    MarcelB
    Guest

    Showing AND downloading a picture in one link

    Hi all,

    I have this page on which people can download a picture by rightclicking a link to it and selecting "Save target as...". Now I also want to be able to show the picture when someone leftclicks it. No problem so far.

    But sometimes the picture that I want to show is too big to fit the page, so I want to resize it first. So I've written a function that determines the width and height of the picture, and then adjusts the display width and height according to the maximum width and height I give to the function as parameters.

    So when a user leftclicks the link, it needs to be redirected to another ASP-page first, where I get the path to the picture as a parameter, then determine the display size by running it through the function, and show it on that new page. (My page is built up of frames, so the user won't notice the redirection)

    So now on my page, the code gets something like this:


    ===========================

    <form name="myform" method="post" action="show_picture.asp">
    <input type="hidden" name="pic">

    <a href="..\upload\049704.jpg" onClick="javascript:return submitform('..\upload\049704.jpg')">049704.jpg</a>

    </form>

    ===========================


    and the function submitform looks like this:

    ===========================

    function submitform(sPic)
    {
    myform.pic.value = sPic;
    myform.submit();
    return false;
    }

    ===========================


    Now for some reason, I get this s t r a n g e error, namely:
    'Expected hexadecimal digit' on the line of the href.

    Anybody got any ideas on why I get this error, or an easier way to do what I want to do? Any help is highly appreciated.

    Thanx in advance,
    Marcel

  2. #2
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Do you actually have the .. before the filename? That's bad to have, and also try changing the \'s to /'s. That may help alleviate the problem. And also change pic.value in your function to pic.src. I think that may help.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  3. #3
    MarcelB
    Guest
    Well, I have it working now the way I had it. The problem was that some files in the database had the full path as filename, and some just had the relative path. As soon as I realised that, it was a matter of checking for it, dealing with it, and it worked.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width