1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Need This Solution ASAP

Discussion in 'Programming' started by i_am_dhaval, Feb 2, 2015.

  1. #1
    "I want to upload an images to a directory from the URL(Link), But using only JavaScript. This URL can be of an image, PDF, audio, video or any kind of file.

    E.g, URL : http://bollywood-india-movie.com/sites/default/files/showtime_logo.png

    I want to upload this(URL Images) file to my Site's upload directory, but only using JavaScript.

    I tried to encode the file in base64 format.I am able to get a string in base64 but I am not able to understand how can I decode the string and store a file in upload directory.

    Is there any one with possible way can let me know how I can move further to do this?
    Please do let me know if there is any other possible way.

    Thanks in Advance!! "
    [​IMG]
     
    i_am_dhaval, Feb 2, 2015 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    You can't use javascript directly to upload a file - you still need to have some sort of server-side script to do the ACTUAL upload.
     
    PoPSiCLe, Feb 2, 2015 IP
  3. i_am_dhaval

    i_am_dhaval Well-Known Member

    Messages:
    1,364
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    138
    #3
    any other solution .

    i think there must be way
     
    i_am_dhaval, Feb 2, 2015 IP
  4. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #4
    And again - javascript is run on the CLIENT - uploads and other stuff is run on the SERVER, and you need a background script, either PHP, Python, ASP - something, that will be able to talk to the file-system and upload the file. It is NOT POSSIBLE to upload anything in PURE javascript.
     
    PoPSiCLe, Feb 2, 2015 IP
  5. i_am_dhaval

    i_am_dhaval Well-Known Member

    Messages:
    1,364
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    138
    #5
    possible in j query ?
     
    i_am_dhaval, Feb 2, 2015 IP
  6. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #6
    jQuery is javascript. Please understand the difference between running something on the client (the browser) and the server (Apache, IIS, whatever you're using). Unless you can use javascript to send the information to a handler script on the server, the file won't go anywhere.
     
    PoPSiCLe, Feb 2, 2015 IP
    sarahk likes this.
  7. Shahzad Jameel

    Shahzad Jameel Well-Known Member

    Messages:
    189
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    148
    #7
    You can do this using AJAX. If you are familiar with it then there will not be any issue.
     
    Shahzad Jameel, Feb 3, 2015 IP
  8. i_am_dhaval

    i_am_dhaval Well-Known Member

    Messages:
    1,364
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    138
    #8
    can you please give me ajex example so i can use that or any javasript or j query example
     
    i_am_dhaval, Feb 3, 2015 IP
  9. malky66

    malky66 Acclaimed Member

    Messages:
    3,996
    Likes Received:
    2,248
    Best Answers:
    88
    Trophy Points:
    515
    #9
    There are tons of examples and tutorials if you only bothered to search
    http://lmgtfy.com/?q=ajax+image+upload
    like @PoPSiCLe said you still need a backend script to process the upload
     
    malky66, Feb 3, 2015 IP
  10. i_am_dhaval

    i_am_dhaval Well-Known Member

    Messages:
    1,364
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    138
    #10
    I want to upload an images to a directory from the URL(Link)

    if i use PHP then the solution will not work on windows share hosting

    so need conman solution that is why i am looking for javascript or j query
     
    i_am_dhaval, Feb 3, 2015 IP
  11. Shahzad Jameel

    Shahzad Jameel Well-Known Member

    Messages:
    189
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    148
    #11
    If PHP is installed there there is no issues to work it on Windows hosting.
     
    Shahzad Jameel, Feb 3, 2015 IP
  12. i_am_dhaval

    i_am_dhaval Well-Known Member

    Messages:
    1,364
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    138
    #12
    yes but if PHP not install then create a problem i already tested
     
    i_am_dhaval, Feb 3, 2015 IP
  13. Shahzad Jameel

    Shahzad Jameel Well-Known Member

    Messages:
    189
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    148
    #13
    Change the hosting then - Simple solution :)
     
    Shahzad Jameel, Feb 3, 2015 IP
  14. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #14
    Uhm - you cannot upload via AJAX alone - AJAX just talks to a server-side script. First off - why in the world do you use a Windows host? And if you need, for instance to be able to run ASP-pages, then just make the background process as an ASP-page instead of PHP?
    But almost every host out there support PHP, and there is no reason why a Windows based host (again, why?) shouldn't have it (although normally you have to have either / or).
    As I've tried to tell you at least a few times now - it's not possible - it's prohibited, and you won't find any way to do it - javascript is NOT supposed to be able to write directly to the server, for obvious reasons.
     
    PoPSiCLe, Feb 3, 2015 IP
    malky66 likes this.
  15. Regrouping-webmaster

    Regrouping-webmaster Active Member

    Messages:
    220
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #15
    They are right, you need to actually have something (anything) on the server side to store/save(retrieve) the file. There are plugins/scripts/etc that could handle this if you use js to upload them. I once tried to write a banner exchange long ago using only javascript. I eventually realized that I no way to save the data or retrieve it!

    Sorry man.
     
    Regrouping-webmaster, Feb 20, 2015 IP
  16. Slincon

    Slincon Well-Known Member

    Messages:
    1,319
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    180
    #16
    As many people have said, @i_am_dhaval request is not technologically possible to upload or write files to a server with javascript alone (on LAMP or Windows environment). You'll need ASP or PHP files to handle placing the file on the server.

    Here's an example with code - http://stard.us.to/qa6v3fu
     
    Slincon, Feb 20, 2015 IP
  17. Dominic Ceraso

    Dominic Ceraso Member

    Messages:
    52
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    38
    #17
    PHP is known to work very well in a windows server environment. In fact - you can download WAMP and have a full blown windows, apache, mysql, php server running in minutes - Now using IIS on an actual windows server - PHP can still be installed and configured, just like on a linux server. You absolutely 110% need a server side script to take the file and push it somewhere. AJAX can handle the transaction from URL to the script but you still need the final script to upload the file. No Jquery, No Javascript no nothing other than a server side language will work.
     
    Dominic Ceraso, Feb 20, 2015 IP