I have this .js
in order to upload a file and show a list of the uploaded files. I have 2 problems:
Thanks
<!DOCTYPE html>
<html>
<body>
<form action="" method="post" enctype="multipart/form-data">
Select image to upload:
<input type="file" name="fileToUpload" id="fileToUpload">
<input type="submit" value="Upload Image" name="submit">
</form>
</body>
</html>
<?php
if (isset($_POST['submit']))
{
echo 'succesfully uploaded';
$structure = 'uploadedfiles/';
$target_file = $structure.basename($_FILES["fileToUpload"]["name"]);
move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file);
}
$dir = 'up/';
$files = scandir($dir);
echo '<h1>List of Uploaded Files</h1> <br><hr>';
$i = 1;
foreach ($files as $key)
{
if ($i>3)
{
$j = $i-3;
echo $j."<a href='up/".$key."'>".$key."</a><hr>";
}
$i++;
}
echo 'End of Files';
?>
If you're referring to the list of files shown on your own site, you'll want to maintain the desired order in some persistent list somewhere, or sort them based on whatever criteria you want, before showing the list of files to the user. (Eg, based on the modified time from the filesystem, etc.)
To upload files to Dropbox programmatically, you'll need to use the Dropbox API:
https://www.dropbox.com/developers/core
There's an official PHP SDK here:
modified
filter in Dropbox(Web) Right click the file you want to use and selected url. It is gonna be something like this:
replace www
with dl
. It is gonna be something like this:
https://dl.dropbox.com/s/6fk1231mvp9idx7/cos.rar?dl=0
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.