hello there I am building a folder upload system with js and PHP
but I got an issue I'm not able to upload a folder that not contains any files
I use
<input type="file" id="picker" name="files" webkitdirectory multiple>
and for getting the file i use
$('input[type="file"]').on("change", function (e) {
let files = $(this).get(0).files;
console.log(files);
});
if a folder contains any file so I can easily access the folder using
files[i].webkitRelativePath
what is the problem
I'm just getting files that contain webkitRelativePath not getting the folders directly
so I'm not able to get any empty subfolders with this approach
can anyone tell me how to access folders directly without webkitRelativePath or anything else so I can handle empty subfolders
Related
I want to select the folder path in windows Not uploading the files in the folder.
<input type="file" webkitdirectory multiple> this option is upload the selected path files.I don't want this to upload the files in my web application.
I want Html code to select the path in windows
I am trying to upload files in the backend and I am successfully done it but the problem is I am uploading the files in a folder. So I need to parse the files so I need to define the folder name so that the file can be parsed. How can I define the folder name?
Here is the code, The folder name is uploads, but when I try to parse the file it says Error: ENOENT: no such file or directory, open '/uploads/undefined-1647961709285.xlsx'
const worksheetsArray = xlsx.parse('/uploads/' + filename);
How do I set or bind a folder path into a v-text-box filed? I don't want to select all the files inside the directory I only needed the folder path.
I tried this
<input type="file" webkitdirectory directory multiple>
but this is selecting all the files from the directory not returning the directory path?
Please help with this.
That's not what the webkitdirectory/directory attributes are for; they will load all the files inside that folder. Either way, there's no way to adchieve what you want cause browsers JS have no access to the File System.
I have this folder/directory 'x' in the public folder of my application.
Now I have path name till the folder i.e., /path/to/dir/x , but I don't know the names of the files in this directory. Now I need to provide URL links to the files in the html a tag's href attribute.
How do I list the name of the files in this directory?
Angular is a client side library. Getting files from file directories is a backend capability.
I'm trying to use this plugin. Everythings work fine, only uploading files won't work. I can create folders, create new files, but if i try to upload any file, it shows me that file is successful uploaded and there is no file.
http://screenshot.cz/HPQH1/
Have you any experience with this problem?
I had some problems with it too, but changing the path configuration in ..\filemanager\config\config.php to your server specific setup is probably key. On a server setup with a site root of e.g. /httpdocs you may end up with something like this:
$base_url = 'http://'.$_SERVER['SERVER_NAME'].'';
$upload_dir = '/source/images/'; // path from base_url to base of upload folder (with start and final /)
$current_path = '../../../../source/images/'; // relative path from filemanager folder to upload folder (with final /)
$thumbs_base_path = '../../../../source/thumbs/'; // relative path from filemanager folder to thumbs folder (with final /)
I had the exact same problem. I could create files and folders but not upload files. It turned out that it didn't had anything to do with the config.php. The problem for me was that when I uploaded the files to the server with ftp, the ../filemanager/upload.php got corrupted.
It happened every time I uploaded this file. No other file had any problem. By setting the ftp protocol to sftp, it got uploaded correctly and then the plugin worked perfectly. So if anyone has the same problem, take a look at the upload.php and see if it's corrupted.