Jump to content
MakeWebGames

Upload Image!


Dragon Blade

Recommended Posts

This will only let staff upload images to file images/username.

Called this file

staff_uploadimage.php

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

 

Now make a file called staff_upload.php

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 
Link to comment
Share on other sites

  • 1 year later...
Who you talking to [MENTION=70383]Tangled[/MENTION]?

oopsie... Dragon Blade I missed putting in the quotes

- - - Updated - - -

 

Who you talking to [MENTION=70383]Tangled[/MENTION]?

Reason I was asking is because when I was instructed in adding images to items I had to make a column for it in items. And for the username images I had to add a column in users

Link to comment
Share on other sites

Not necessarily needs a field in database, if he is only allowing one to be stored in the directory of images/username

I take it he is naming the image the username, than just echoing the username field where the image name is echoed..

such <img src="/images/username/".$ir['username'].".png"> OR <img src="/images/username/".$r['username'].".png"> where ever he is echoing the image.

Link to comment
Share on other sites

I got bored, so made an automated AJAX image uploader.

Requirements; HTML5 browser that supports the FILE API.

Demo: Here

Codes (As is, on my site -- I used bootstrap to throw the page together quickly. You shouldn't need any of that.)

-- Index.php

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

-- uploader.js

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Be sure to include jQuery (I used 1.11) for this to work.

Edited by Guest
Link to comment
Share on other sites

  • 2 weeks later...

[MENTION=50378]Guest[/MENTION] - Demo Website

<br />

<b>Warning</b>: move_uploaded_file(uploads/Screen Shot 2014-10-28 at 12.08.58 1.png): failed to open stream: Permission denied in <b>/var/www/html/uploader/index.php</b> on line <b>16</b><br />

<br />

<b>Warning</b>: move_uploaded_file(): Unable to move '/tmp/php81e8Vg' to 'uploads/Screen Shot 2014-10-28 at 12.08.58 1.png' in <b>/var/www/html/uploader/index.php</b> on line <b>16</b><br />

Link to comment
Share on other sites

@Guest - Demo Website

<br />

<b>Warning</b>: move_uploaded_file(uploads/Screen Shot 2014-10-28 at 12.08.58 1.png): failed to open stream: Permission denied in <b>/var/www/html/uploader/index.php</b> on line <b>16</b><br />

<br />

<b>Warning</b>: move_uploaded_file(): Unable to move '/tmp/php81e8Vg' to 'uploads/Screen Shot 2014-10-28 at 12.08.58 1.png' in <b>/var/www/html/uploader/index.php</b> on line <b>16</b><br />

That's now fixed.

Updated the server a couple days back and it seems to have set some file/folder permissions to their defaults =/

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