Jump to content
MakeWebGames

PHP and Uploading


k1ngscorp1o

Recommended Posts

I am looking for some advice from people with experience uploading to their website with custom scripts.

I essentially want to make an uploader, members will be able to input their name, desc, and category and I was

wondering I wan can make it so they can upload their thumbnail with it. Is the upload its own form inside of the

main form, or how would that work? Also what if I wanted 2 upload spots in the form, so:

name

desc

upload 1

upload 2

[submit]

Then on submit the images are uploaded to their correct places and stored in the database all at the same time.

I may just be over thinking it but looking upt uploading for a few hours not sure how id get it working as 1 form.

Link to comment
Share on other sites

With TopListedGames, I made use of the imgur api - it worked effectively! They return file information with JSON, once uploaded.

Apart from that, have a look at these.

With regards to the 'which form' issue, it depends how you want to handle it. I'd put it in the same form as everything else, if I were you.

<form action="" method="post" class="form-horizontal" enctype="multipart/form-data">
<label>Name</label> <input type="text" name="name" /> <br />
<label>Description</label> <textarea name="desc"></textarea> <br />
<label>Upload 1</label> <input type="file" name="upload1" /> <br />
<label>Upload 2</label> <input type="file" name="upload2" /> <br />
</form>

 

Then, just use the superglobal; $_FILES, and upload as you would by using predefined functions :)

Edited by sniko
Link to comment
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.   Paste as plain text instead

  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...