沃梦达 / 编程问答 / php问题 / 正文

如何为文件上传按钮设置值

How to set a value for file upload button(如何为文件上传按钮设置值)

本文介绍了如何为文件上传按钮设置值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,我们可以在其中选择图像并存储它,当用户需要更改图像的属性(如高度、宽度、图像)时,他将去编辑页面并对其进行编辑..但是,如果用户仅更改高度和宽度而不更改图像,则图像将不会显示,因为图像值不会为文件获取/设置...那么我们如何动态设置文件上传按钮的路径...

I have an application where we can select image and store it and when user needs to change a properties of image like height,width,image he will go to edit page and he will edit it.. But when the user does not change image if he changes only height and width then the image will no display because the image value will not fetch/set for file... So how can we dynamically set path for a file upload button...

推荐答案

答案很简单;你不能.

只需检查图像是否设置.如果是这样,请上传新图像.如果没有,请不要将图像替换为您已有的图像.这是一项安全措施,您不希望能够上传所选网站的文件.

Just check whether the image is set. If so, upload the new image. If not, don't replace the image with the image you already have. This is a safety measure, you don't want to be able to upload a file of the websites choise.

这篇关于如何为文件上传按钮设置值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:如何为文件上传按钮设置值

基础教程推荐