Jump to content

Recommended Posts

It always seems so simple.... LOL

Hello to my old friends,

I have been toying with adding an UPLOAD SCRIPT for moving images from a desktop to a website in order to eliminate the need to log into the server to post images.

I've seen a few online scripts of various degrees and some with demos), yet the one blaring question remains: Where is the line that dictates where the files end up?

So many of the scripts explain how wonderfully they look and operate, but they do not indicate where to edit in order to control the endpoint.

Any insight, as well as guidance to avoid pitfalls with regard to this venture will be appreciated.

Happy Halloween, as if coding isn't scary enough (at times).  *wink*

 

 

Link to comment
https://forums.phpfreaks.com/topic/309435-dgar-and-drop-upload-script/
Share on other sites

4 hours ago, phppup said:

I've seen a few online scripts of various degrees and some with demos), yet the one blaring question remains: Where is the line that dictates where the files end up?

Exactly what kind of answer are you looking for? How can anyone reply to that question in a way that doesn't make the answer sound obvious?

An obvious answer would be ok. Sometimes the most difficult solutions are in plain sight.

I am not doing the images in a database, so I am looking at JS scripting.

I want sure if the destination folder is required to be at the top of a script, or file some specific guidelines.

I'm sure I'll eventually find the answer, but I was hoping for a clue that might help me save some time.

 

3 minutes ago, phppup said:

An obvious answer would be ok.

Then the answer to "where is the line I need to edit" is either "whatever the code says the line is" or "whatever the documentation says the line is".

In other words,

:psychic:

3 minutes ago, phppup said:

I am not doing the images in a database, so I am looking at JS scripting.

I don't see what one has to do with the other.

3 minutes ago, phppup said:

I want sure if the destination folder is required to be at the top of a script, or file some specific guidelines.

Javascript cannot upload files to a directory on your server. Thankfully. You have to have an script to receive uploaded files and process them according to however you want.

Yeah. Javascript runs on the browser. Not the server. (Except like Node.js, that's different.) And it would be an extremely terrible idea to allow Javascript on someone's browser to upload files to your server without your say-so.

Drag 'n drop is done with an AJAX system; a JavaScript front-end script packages the image data into a FormData object, and the AJAX operation will POST that to a PHP handler script on the server, which then does the work to put it someplace just like we did in the Elder Days when we used a basic upload form in HTML.  So, at the very least you need two scripts, one PHP and one in JS.

  • 3 weeks later...

After a lot of reading and some progress, there are now a whole new set of questions that have emerged.

So this thread requires more discussion and opinion for guidance, rather than actual code solutions.

I have found different approaches to uploading image files. Some upload directly to a destination folder. Some upload to a database. Some do both.

It seems more practical to upload image files to a folder (although I do recognize the bonus of having information about the individual files stored for reference), but is there a benefit to using one instead of the other? For space? Speed? Other implementations?
 

Edited by phppup
6 hours ago, phppup said:

I have found different approaches to uploading image files. Some upload directly to a destination folder. Some upload to a database. Some do both.

Correction: some upload to a server-side script that then places the file in a destination folder, and some upload to a server-side script that then places the file into a database.

6 hours ago, phppup said:

It seems more practical to upload image files to a folder (although I do recognize the bonus of having information about the individual files stored for reference), but is there a benefit to using one instead of the other? For space? Speed? Other implementations?

If you only have one server then store in a folder. It's just easier to work with. If you have multiple servers and a shared storage space then I personally would still store as a file, and if not then use the database.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.