Jump to content
phppup

dgar and drop upload script

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*

 

 

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

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.

 

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Are you saying that even if the JavaScript is on the server, it will not be able to put the image files on the same server?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

So a decent script would include a php file that connects to the server, and validates the file type or 'scrubs it' for security purposes?

Share this post


Link to post
Share on other sites

No, because a decent "script" doesn't know you or your application or your server.

Perish the thought but you have to actually do some work here.

Share this post


Link to post
Share on other sites

That's exactly what I was trying to avoid.   LoL.

 

Thanks.

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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.