开发者

uploading image and downloading

In my web application, I need to be able to allow users to upload and download their images. How can this be done in php

I want to user to be able to sign in (I already ha开发者_如何学Gove that done) and be able to upload images to their account. Later on, I want them to be able to download them.


Here is an example, how you can upload a file.

Write a form like this (note that enctype="multipart/form-data" parameter is required):

<form action="upload_handler.php" method="post" enctype="multipart/form-data">
     <input type="file" name="img">
</form>

And the upload_handler.php would be:

That's it! Reed more in PHP docs: http://php.net/manual/en/features.file-upload.php

If you need to resize the image, you can use GD library for PHP: http://icant.co.uk/articles/phpthumbnails/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜