小女子 晕了!一个图片上传问题

michelle0618 2004-04-09 05:36:04
请问各位大侠,我能不能在只根据一个只是字符串类型 得图片地址 上传这张图片啊?比如我得到一个字符串 $picPath = "d://job/pic/love.png"; 我能不能就根据这个字符串型的地址上传这张图片啊?

请求各位高手帮忙啊,这个困绕我几天了,再不解决就要挨头的k了,咳!
...全文
44 8 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
418503 2004-04-10
  • 打赏
  • 举报
回复
<tr bgcolor="#FFFFFF" align="center">
<td height="34"><font size="2">联系电话</font></td>
</tr>
</table></td>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
<tr bgcolor="#FFFFFF">
<td height="34"><font size="2"> 
<input type="text" name="billing_telephone" size="30" value="">
<font color="#FF9A00">(必填) </font></font></td>
</tr>
</table></td>
</tr>
<tr>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#EFEFEF">
<tr bgcolor="#FFFFFF" align="center">
<td height="34"><font size="2">订货人邮箱</font></td>
</tr>
</table></td>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
<tr bgcolor="#FFFFFF">
<td height="34"><font size="2"> 
<input type="text" name="billing_email_address" size="30" value="">
<font color="#FF9A00">(必填,订单邮件将发送到此电子邮箱中) </font></font></td>
</tr>
</table></td>
</tr>
<tr>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#EFEFEF">
<tr bgcolor="#FFFFFF" align="center">
<td height="34"> </td>
</tr>
</table></td>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
<tr bgcolor="#FFFFFF">
<td height="34"><font size="2"> 
<input type="checkbox" name="issame" value="true" onClick="javascript:same_address();">
收货人信息与订货人信息相同</font></td>
</tr>
</table></td>
</tr>
</table>
<br>
<br>
<table width="774" border="0" cellspacing="1" cellpadding="0" align="center" bgcolor="#008DC3">
<tr>
<td colspan="2"> <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#EFEFEF">
<tr bgcolor="#EFEFEF" align="center">
<td height="25"><font size="2">请填写 收货人详细信息</font></td>
</tr>
</table></td>
</tr>
<tr>
<td width="200"> <table width="200" border="0" cellspacing="0" cellpadding="0" bgcolor="#EFEFEF">
<tr bgcolor="#FFFFFF" align="center">
<td height="34"><font size="2">收货人姓名</font></td>
</tr>
</table></td>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
<tr bgcolor="#FFFFFF">
<td height="34"><font size="2"> 
<input type="text" name="delivery_name" value="">
<font color="#FF9A00">(必填) </font></font></td>
</tr>
</table></td>
</tr>
<tr>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#EFEFEF">
<tr bgcolor="#FFFFFF" align="center">
<td height="34"><font size="2">详细地址</font></td>
</tr>
</table></td>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
<tr bgcolor="#FFFFFF">
<td height="34"><font size="2"> 
<input type="text" name="delivery_street_address" size="60" value="">
<font color="#FF9A00">(必填) </font></font></td>
</tr>
</table></td>
</tr>
<tr>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#EFEFEF">
<tr bgcolor="#FFFFFF" align="center">
<td height="34"><font size="2">邮政编码</font></td>
</tr>
</table></td>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
<tr bgcolor="#FFFFFF">
<td height="34"><font size="2"> 
<input type="text" name="delivery_postcode" size="10" value="">
<font color="#FF9A00">(必填) </font></font></td>
</tr>
</table></td>
</tr>
<tr>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#EFEFEF">
<tr bgcolor="#FFFFFF" align="center">
<td height="34"><font size="2">联系电话</font></td>
</tr>
</table></td>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
<tr bgcolor="#FFFFFF">
<td height="34"><font size="2"> 
<input type="text" name="delivery_telephone" size="30" value="">
<font color="#FF9A00">(必填) </font></font></td>
</tr>
</table></td>
</tr>
<tr>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#EFEFEF">
<tr bgcolor="#FFFFFF" align="center">
<td height="34"><font size="2">收货人邮箱</font></td>
</tr>
</table></td>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
<tr bgcolor="#FFFFFF">
<td height="34"><font size="2"> 
<input type="text" name="delivery_email_address" size="30" value="">
</font></td>
</tr>
</table></td>
</tr>
</table>
<input type="button" name="Submit2" value="<<上一步" onClick="javascript:subform();">
  
<input type="submit" name="Submit" value="填写完毕,下一步>>">
<br>
<br>
</form></td>
</tr>
</table>
</body>
</html>
418503 2004-04-10
  • 打赏
  • 举报
回复
在界面上我有17个<input type=file> 当我点击第一个<input>得浏览按钮添加图片时,我其他的16个<input>就自动把第一个<input>得值添加上,只是图片的名称不同
---------------------------------------------------------------------------------
这个功能的实现需要一段JS来支持,我给段代码你做参考
<html>
<head>
<title>购物车</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<script language="JavaScript">
function subform(){
document.filladdress.action="index.php";
document.filladdress.submit();
}
</script>
<SCRIPT LANGUAGE="JavaScript">
<!--
function same_address() {
if(document.filladdress.issame.checked) {
document.filladdress.delivery_street_address.value = document.filladdress.billing_street_address.value;
document.filladdress.delivery_name.value = document.filladdress.billing_name.value;
document.filladdress.delivery_postcode.value = document.filladdress.billing_postcode.value;
document.filladdress.delivery_telephone.value = document.filladdress.billing_telephone.value;
document.filladdress.delivery_email_address.value = document.filladdress.billing_email_address.value;
}
document.filladdress.customers_name.value = document.filladdress.billing_name.value;
document.filladdress.customers_street_address.value = document.filladdress.billing_street_address.value;
document.filladdress.customers_postcode.value = document.filladdress.billing_postcode.value;
document.filladdress.customers_telephone.value = document.filladdress.billing_telephone.value;
document.filladdress.customers_email_address.value = document.filladdress.billing_email_address.value;
}

function submit_check() {
var form = document.filladdress;

if(form != null) {

if(!CheckInput(form.billing_name.value,2,20,"订货人姓名",false)) {
form.billing_name.focus();
return false;
}
if(!CheckInput(form.billing_street_address.value,2,120,"订货人详细地址",false)) {
form.billing_street_address.focus();
return false;
}

if(!isIntEx(form.billing_postcode.value, "订货人邮政编码",6,"=")) {
form.billing_postcode.focus();
return false;
}

if(!CheckInput(form.billing_telephone.value, 6, 60, "订货人联系电话", false)) {
form.billing_telephone.focus();
return false;
}
if(!isEmail(form.billing_email_address.value,"订货人邮箱")) {
form.billing_email_address.focus();
return false;
}
if(!CheckInput(form.delivery_name.value,2,20,"收货人姓名",false)) {
form.delivery_name.focus();
return false;
}

if(!CheckInput(form.delivery_street_address.value,2,120,"收货人详细地址",false)) {
form.delivery_street_address.focus();
return false;
}

if(!isIntEx(form.delivery_postcode.value, "收货人邮政编码",6,"=")) {
form.delivery_postcode.focus();
return false;
}

if(!CheckInput(form.delivery_telephone.value, 6, 60, "收货人联系电话", false)) {
form.delivery_telephone.focus();
return false;
}
return true;
}
return false;
}

//-->
</SCRIPT>
<body topmargin="0">
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">




<td height="135" valign="top"><form name="filladdress" action="payOk.php" method="post" onSubmit="javascript:return submit_check();">
</td>
</tr>
<tr>
<td width="200"> <table width="200" border="0" cellspacing="0" cellpadding="0" bgcolor="#EFEFEF">
<tr bgcolor="#FFFFFF" align="center">
<td height="34"><font size="2">订货人姓名</font></td>
</tr>
</table></td>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
<tr bgcolor="#FFFFFF">
<td height="34"><font size="2"> 
<input type="text" name="billing_name" value="">
<font color="#FF9A00">(必填) </font></font></td>
</tr>
</table></td>
</tr>
<tr>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#EFEFEF">
<tr bgcolor="#FFFFFF" align="center">
<td height="34"><font size="2">详细地址</font></td>
</tr>
</table></td>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
<tr bgcolor="#FFFFFF">
<td height="34"><font size="2"> 
<input type="text" name="billing_street_address" size="60" value="">
<font color="#FF9A00">(必填) </font></font></td>
</tr>
</table></td>
</tr>
<tr>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#EFEFEF">
<tr bgcolor="#FFFFFF" align="center">
<td height="34"><font size="2">邮政编码</font></td>
</tr>
</table></td>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
<tr bgcolor="#FFFFFF">
<td height="34"><font size="2"> 
<input type="text" name="billing_postcode" size="10" value="">
<font color="#FF9A00">(必填) </font></font></td>
</tr>
</table></td>
</tr>
<tr>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#EFEFEF">
接下面的
hbcb 2004-04-09
  • 打赏
  • 举报
回复
<?php
//file_name:pic.php
if($tmp_file_name=$HTTP_POST_FILES['pic_file'][tmp_name']){ //取得上传的临时文件名
$new_file_name="/home/test"; //最后希望保存的文件名
copy($tmp_file_name,$new_file_name); //把临时文件复制到目标文件中
}
?>

<form method=POST action="pic.php" enctype="multipart/form-data">
<input type="file" name="pic_file">
<input type="submit" value="提交">
</form>


试试这个
52juanjuan 2004-04-09
  • 打赏
  • 举报
回复
up 一下吧,现在好晕~~~~~~~~~~~~~~~~~~~~~
michelle0618 2004-04-09
  • 打赏
  • 举报
回复
相对路径可以上传吗?我可以得到他的相对路径,请问如果得到相对路径我怎么实现上传呢?能不能把代码贴出来啊? 小女子在此多谢各位大侠,我都被这个搞得头都晕了,今天一天都没吃饭呢,嗬嗬,咳!可怜啊!
hope1983 2004-04-09
  • 打赏
  • 举报
回复
d://job/pic/love.png
这是绝对路径不是相对路径
michelle0618 2004-04-09
  • 打赏
  • 举报
回复
啊?我的所有图片都是在客户机上呢,所以地址肯定也是客户机上的,因为我要给客户这个上传图片的界面,咳!也就是说我没有办法了?
我真是晕了,我真正要做的是
在界面上我有17个<input type=file> 当我点击第一个<input>得浏览按钮添加图片时,我其他的16个<input>就自动把第一个<input>得值添加上,只是图片的名称不同,然后把这17张图片分别上传到17个目录底下,
请教各位高手阿,有什么好办法可以解决啊?!!!!
hbcb 2004-04-09
  • 打赏
  • 举报
回复
如果这个是地址是在Web上的应该可以

如$picPath="http://www.test.com/pic/love.png";
但是如果是在客户机上,则是不可以的

21,893

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧