-1

I am using JavaScript to upload images to a table on another page on the site. The current that I'm currently using looks like this.

<td width="10%">1</td>
                <td width="10%"><?php if(file_exists('upload_folder/1.jpg')){ ?><img src="upload_folder/1.jpg" /><?php }else{ echo "No Picture";} ?></td>
                <td width="60%">This is product number 1</td>
                <td width="10%"></td>
                <td width="10%"></td>

This code is great as long as I know in advanced, what the "product ID" is going to be, however the table is going to be updated at different times (and I don't know how many products there are going to be), so I won't know what the ID will be.

I would like it so that when an admin user uploads an image, they can put the image into a particular cell without knowing the product ID.

So far, I've tried using $productID = $_POST['productid']; and scandir(). however, these don't seem to work.

I hope someone, will be able to help, and that I haven't made this too confusing (I'm a little confused myself).

4

1 回答 1

0

可能有几种方法可以解决这个问题。一种是拥有一个包含所有产品 ID 的文件。打开文件并使用此信息构建您的表。将每一行添加到显示表时,请在图像文件夹中查找相应的图像。如果找到,添加它。否则输入“无图像”文本。

于 2013-07-17T14:50:17.763 回答