我试图允许用户通过此表单上传视频
<form method='POST' name='uploadform' enctype='multipart/form-data' action=''>
Video: <input type='file' name='filename' /><br/>
<input type='submit' name='cmdSubmit' value='Upload' />";
Run Code Online (Sandbox Code Playgroud)
然后使用这个PHP脚本,我试图将视频移动到另一个文件夹进行存储.
if($_POST['cmdSubmit']){
$filename = basename($_FILES['filename']['name']);
move_uploaded_file($_FILES['filename']['tmp_name'], "videos/" . $filename);
}
Run Code Online (Sandbox Code Playgroud)
我遇到的问题是视频没有移动到我的文件夹.我已经研究了如何做到这一点,并尝试了许多错误解决方法,但似乎没有任何工作,所以如果你对我的问题有任何想法,任何帮助是值得赞赏的.表格完美无缺.谢谢....
我已经搜索过google和youtube,如果你知道任何一个非常棒的话,也找不到任何真正好的文章.
我尝试使用此代码进行故障排除..
if(move_uploaded_file($_FILES['filename']['tmp_name'], "videos/" . $filename)){
echo "This worked Successfully";
}else{
echo "Error";
}
}
Run Code Online (Sandbox Code Playgroud)
并且它没有回应任何一个声明....
因此,我在使用PHP编写GD功能时遇到一些麻烦,以便在我的s3存储桶中存储之前调整上传到150x150px的所有图像.
为了确认,这个代码当前工作,没有调整大小的功能,我似乎无法找到一个简单的GD功能来实现这一点.
真的很感激一些帮助,所以提前谢谢!
//instantiate the class
$s3 = new S3(awsAccessKey, awsSecretKey);
//store our temporary reference to our image
$activityContent = $_FILES['uploaded']['name'];
$fileTempName = $_FILES['uploaded']['tmp_name'];
//Resize the file
//move the file to S3
if ($s3->putObjectFile($fileTempName, "spartadev", $activityContent, S3::ACL_PUBLIC_READ))
{
echo "Success!
}
else
{
echo "Something went wrong while uploading your file... sorry.";
}
Run Code Online (Sandbox Code Playgroud)