草庐IT

附件上传

全部标签

php - Yii 使用模型上传文件

我只是想使用模型上传文件。我在当前情况下收到异常消息(请参阅下面的模型/Controller/View):CExceptionMyFileanditsbehaviorsdonothaveamethodorclosurenamed"save".如果我的模型扩展了CActiveRecord而不是CFormModel,则存在另一个异常:CDbExceptionThetable"MyFile"foractiverecordclass"MyFile"cannotbefoundinthedatabase.我的错误是什么?这些是文件:模型:MyFile.phpclassMyFileextendsCF

javascript - 使用javascript上传图片

我卡住了!!:(我想上传带有标题和说明的图像文件,我想使用javascript验证标题说明和选择的文件。我的html在这里:captiongoeshere...post还有我的javascript:functionphotowcap(){vartitle=document.getElementsByName("title2")[0].value;varphoto=document.getElementsByName("photo")[0].value;varcaptions=document.getElementsByName("caption")[0].value;varcaptio

php - 检查上传文件数组中是否存在文件

我在前端获得了提交内容的表单,其中我需要在提交时检查文件是否存在。请注意,该表单提交文件数组。它失败了我一直在尝试的所有逻辑。请注意html第二行的upload[]。HTMLPHPif(!file_exists($_FILES['upload']['tmp_name'].'/'.$FILES['upload']['name'])){$upload_error='fileisnotset!';return;//stopfurthercodeexecution}else{//dofurthervalidation}上面的代码在两种情况下都显示了'fileisnotset!',即当我在没有上

php - Instagram API 被黑以允许上传?

根据本新闻稿:https://madmimi.com/p/7a2394?fe=1&pact=23816224659#,该公司可以直接上传到Instagram。我认为上传到Instagram的API是不允许的?有谁知道这是怎么做到的? 最佳答案 根据Instagram的API文档:Atthistime,uploadingviatheAPIisnotpossible.Wemadeaconsciouschoicenottoaddthisforthefollowingreasons...虽然可以使用Instagram的私有(private)

php - 使用以下用于上传图像的 PHP 代码上传时减小图像大小

我正在尝试使用以下代码将图像上传到服务器以下是使用下面给定的代码完成的上传文件重命名我需要的是我需要使用以下代码减小图像大小这是代码$file_name=$HTTP_POST_FILES['ufile']['name'];$random_digit=md5(rand()*time());$new_file_name=$random_digit.$file_name;$path="upload/".$new_file_name;if($ufile!=none){if(copy($HTTP_POST_FILES['ufile']['tmp_name'],$path)){echo"Succe

php - Amazon S3 上传错误 PermanentRedirectException

我已经使用composer安装了AmazonSDKforPHP。我复制了示例代码并在我的系统中实现,但是当我尝试上传文件时,我得到以下信息(为了安全我已经将路径设为通用):Fatalerror:Uncaughtexception'Aws\S3\Exception\PermanentRedirectException'withmessage'Encounteredapermanentredirectwhilerequestinghttps://s3.amazonaws.com/mybucket/path/to/image.jpg.Areyousureyouareusingthecorre

php - 我如何上传视频并将其保存到 codeigniter 中的文件夹中?

我是codeigniter的新手。我需要帮助来上传图片和视频并将其保存到文件夹和数据库。这是我的Controllerpublicfunctionupload(){$this->m_upload->upload();$this->upload_gambar();}publicfunctionupload_gambar(){//loadthehelper$this->load->helper('form');$config['upload_path']='assets/gallery/images';$config['allowed_types']='gif|jpg|png|mp4';$c

javascript - summernote js上传图片

我使用的是summernote版本0.8.1(当前)。它正在工作。但是我挣扎的一件事。插入图片,而不是放base64dataURL,我想将图片上传到服务器并将图片URL插入数据库。这是我的代码:$(document).ready(function(){$('#summernote').summernote({lang:'fr-FR',height:300,toolbar:[['style',['bold','italic','underline','clear']],['font',['fontsize']],['color',['color']],['para',['ul','ol'

php - 如何通过 SFTP 从 PHP 上传文件

我在使用PHP将文件上传到远程服务器时遇到问题。当我使用cURL时,出现此处描述的错误:SFTPfromPHP-undefinedconstantCURLOPT_PROTOCOLSandCURLPROTO_SFTP?我还按照建议尝试了phpseclib:SFTPfromwithinPHP但是当我尝试phpseclib时,我得到了这些错误:Warning:require_once(Math/BigInteger.php)[function.require-once]:failedtoopenstream:Nosuchfileordirectoryin/home/john/public_h

php - Swift Mailer 附件

我正在使用PHP即时创建CSV,然后我需要将此CSV文件附加到SwiftMailer消息。我尝试在创建的文件上使用file_get_content以及在创建的文件上使用chunk_split(base64_encode(file_get_contents())以及在将文件写入磁盘之前附加文件。没有写入磁盘我在CSV中得到Rescource#183,附加它与file_get_content我在CSV文件的每一行中只得到一个字符串,有人知道我做错了什么吗?if(!file_exists(_PS_ORDERS_DIR_.$orderDate.'/'.$file_name.'.csv')){i