在目录文件夹中上传图像并将图像保存到该文件夹​​?然后自动显示该照片 [英] upload image in directory folder and save an image to that folder? Then display that photo automatically

查看:72
本文介绍了在目录文件夹中上传图像并将图像保存到该文件夹​​?然后自动显示该照片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发布私人广告

1->图像将上传到服务器目录中

2->通过paypal buynow按钮付款

3->付款后将图像显示echo< img src =/ path /'$ img'/>

i am没有在目录中的上传图像中出现问题然后主要问题是如何显示该用户最近上传的特定图像,因为将有超过10个框,因此如果用户选择任何一个,那么图像将仅显示在该特定框上

i making an post private ads
1-> image will upload in server directory
2-> payment via paypal buynow button
3->after payment then will image show echo " <img src="/path/'$img' />
i am not getting problem in upload image in directory then main issue is how to display that particular image that was recently uploaded by that user because there will be more than 10 box so every if user select any of that then image will display on that particular box only

echo $ img
echo $img

..我想你得到它.. plz帮助我



通过php上传目录代码



1-> Upload.form.php



< html lang =en>

< head>

< meta http-equiv =content-typecontent =text / html; charset = iso-8859-1>



< title>上传表单< / title>

< / head>

< body>

< form id =Uploadaction =enctype =multipart / form-datamethod =post>

上传表格

< input type =hiddenname =MAX_FILE_SIZEvalue =>

< label for =file>要上传的文件:< / label>

< input id =filetype =filename = 文件 >

< label for =submit>按到...< / label>

< input id =submittype =submitname =submitvalue =上传我!>

< / form>

< / body>

< / html>

---------------- -------------------------------------------------- ----------------------------



2-> Upload.processor.php



'php.ini超出文件大小',

2 => 'html表格超出最大文件大小',

3 => '文件上传只是部分',

4 => '没有附加文件');



//检查上传表单是否实际提交了其他打印表格

isset($ _ POST ['提交'])

或错误('上传表单已上传',$ uploadForm);



//检查标准上传错误

($ _FILES [$ fieldname] ['error'] == 0)

或错误($ errors [$ _ FILES [$ fieldname] ['error']] ,$ uploadForm);



//检查我们正在处理的文件是否真的是HTTP上传

@is_uploaded_file($ _ FILES [ $ fieldname] ['tmp_name'])

或错误('不是HTTP上传',$ uploadForm);



//验证...因为这是一个图片上传脚本我们

//应该运行检查以确保上传是一张图片

@geignerize($ _ FILES [$ fieldname] ['tmp_name'])

或错误('只允许图片上传',$ uploadForm);



//制作一个独特的上传文件的文件名并检查它是

//没有被采取...如果它一直在尝试,直到找到一个空的

$ now = time();

while(file_exists($ uploadFilename = $ uploadsDirectory。$ now .'-'。$ _ FILES [$ fieldname] ['name']))

{

$ now ++ ;

}



//现在让我们将文件移到最后并用新文件名分配

@move_uploaded_file($ _ FILES [$ fieldname] ['tmp_name'],$ uploadFilename)

或错误('接收目录insuffiecient permission',$ uploadForm);



//如果到目前为止,一切正常,文件已成功保存。

//我们现在要将客户端重定向到成功页面。 br />
header('Location:'。 $ uploadSuccess);



//制作一个错误处理程序,如果上传失败将会使用

函数错误($ error,$ location) ,$ seconds = 5)

{

header(刷新:$秒; URL = \$ location \);

echo''。\ n \ n。

'< html lang =en>'。\ n。

'< head>'。\ n。

'< meta http-equiv =content-typecontent =text / html; charset = iso-8859-1> ;'。\\\\ n \\ n。

''。\ n \ n。

'< title>上传错误< / title> ;'。\ n \ n。

'< / head>'。\ n \ n。

'< body> '。\ n \ n。

''。\ n \ n。

'上传失败'。\ n \ n。

'发生了错误:'。\ n \ n。

''。 $错误。 '...'。\ n\ n。

'上传表单正在重新加载'。\ n\ n。

'' 。\ n \\ n。

'< / html>';

退出;

} //结束错误处理程序



?>



--------------- -------------------------------------------------- ------------------------------



3-> Upload.success.php



< html lang =en>

< head>

< meta http-equiv =content-typecontent =text / html; charset = iso-8859-1>

< title>成功上传< / title>

< / head>

< body>

文件上传

恭喜!您的文件上传成功



< / body>

< / html>

.. i think all you got it .. plz help me

Upload image in directory via php code

1-> Upload.form.php

<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">

<title>Upload form</title>
</head>
<body>
<form id="Upload" action="" enctype="multipart/form-data" method="post">
Upload form
<input type="hidden" name="MAX_FILE_SIZE" value="">
<label for="file">File to upload:</label>
<input id="file" type="file" name="file">
<label for="submit">Press to...</label>
<input id="submit" type="submit" name="submit" value="Upload me!">
</form>
</body>
</html>
----------------------------------------------------------------------------------------------

2-> Upload.processor.php

'php.ini max file size exceeded',
2 => 'html form max file size exceeded',
3 => 'file upload was only partial',
4 => 'no file was attached');

// check the upload form was actually submitted else print form
isset($_POST['submit'])
or error('the upload form is neaded', $uploadForm);

// check for standard uploading errors
($_FILES[$fieldname]['error'] == 0)
or error($errors[$_FILES[$fieldname]['error']], $uploadForm);

// check that the file we are working on really was an HTTP upload
@is_uploaded_file($_FILES[$fieldname]['tmp_name'])
or error('not an HTTP upload', $uploadForm);

// validation... since this is an image upload script we
// should run a check to make sure the upload is an image
@getimagesize($_FILES[$fieldname]['tmp_name'])
or error('only image uploads are allowed', $uploadForm);

// make a unique filename for the uploaded file and check it is
// not taken... if it is keep trying until we find a vacant one
$now = time();
while(file_exists($uploadFilename = $uploadsDirectory.$now.'-'.$_FILES[$fieldname]['name']))
{
$now++;
}

// now let's move the file to its final and allocate it with the new filename
@move_uploaded_file($_FILES[$fieldname]['tmp_name'], $uploadFilename)
or error('receiving directory insuffiecient permission', $uploadForm);

// If you got this far, everything has worked and the file has been successfully saved.
// We are now going to redirect the client to the success page.
header('Location: ' . $uploadSuccess);

// make an error handler which will be used if the upload fails
function error($error, $location, $seconds = 5)
{
header("Refresh: $seconds; URL=\"$location\"");
echo ''."\n\n".
'<html lang="en">'."\n".
' <head>'."\n".
' <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">'."\n\n".
' '."\n\n".
' <title>Upload error</title>'."\n\n".
' </head>'."\n\n".
' <body>'."\n\n".
' '."\n\n".
' Upload failure'."\n\n".
' An error has occured: '."\n\n".
' ' . $error . '...'."\n\n".
' The upload form is reloading'."\n\n".
' '."\n\n".
'</html>';
exit;
} // end error handler

?>

-----------------------------------------------------------------------------------------------

3-> Upload.success.php

<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>Successful upload</title>
</head>
<body>
File upload
Congratulations! Your file upload was successful

</body>
</html>

推荐答案

img'/>

i在目录中的上传图片中没有出现问题然后主要问题是如何显示该用户最近上传的特定图像,因为会有更多如果用户选择任何一个,那么每个只有
img' />
i am not getting problem in upload image in directory then main issue is how to display that particular image that was recently uploaded by that user because there will be more than 10 box so every if user select any of that then image will display on that particular box only
echo


img

..我认为所有你明白了.. plz帮帮我



通过php代码在目录中上传图片



1-> ; Upload.form.php



< html lang =en>

< head>

< meta http-equiv =content-typecontent =text / html; charset = iso-8859-1>



< title>上传表单< / title>

< / head>

< body>

< form id =Uploadaction =enctype =multipart / form-datamethod =post>

上传表格

< input type =hiddenname =MAX_FILE_SIZEvalue =>

< label for =file>要上传的文件:< / label>

< input id =filetype =filename = 文件 >

< label for =submit>按到...< / label>

< input id =submittype =submitname =submitvalue =上传我!>

< / form>

< / body>

< / html>

---------------- -------------------------------------------------- ----------------------------



2-> Upload.processor.php



'php.ini超出文件大小',

2 => 'html表格超出最大文件大小',

3 => '文件上传只是部分',

4 => '没有附加文件');



//检查上传表格是否实际提交其他打印表格

isset(

.. i think all you got it .. plz help me

Upload image in directory via php code

1-> Upload.form.php

<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">

<title>Upload form</title>
</head>
<body>
<form id="Upload" action="" enctype="multipart/form-data" method="post">
Upload form
<input type="hidden" name="MAX_FILE_SIZE" value="">
<label for="file">File to upload:</label>
<input id="file" type="file" name="file">
<label for="submit">Press to...</label>
<input id="submit" type="submit" name="submit" value="Upload me!">
</form>
</body>
</html>
----------------------------------------------------------------------------------------------

2-> Upload.processor.php

'php.ini max file size exceeded',
2 => 'html form max file size exceeded',
3 => 'file upload was only partial',
4 => 'no file was attached');

// check the upload form was actually submitted else print form
isset(


_POST ['submit'])

或错误('上传表格已经上传',
_POST['submit'])
or error('the upload form is neaded',


这篇关于在目录文件夹中上传图像并将图像保存到该文件夹​​?然后自动显示该照片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆