ResponsiveFilemanager won't upload files - javascript

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.

Related

How can I disable conversion of .json/.webmanifest url into base64 string?

I have a problem that has been bothering me for a while now. I have a vite-react-typescript project in VSCode, with a link in the index.html page to a webmanifest. This is basically a json file with a different extention.
When I build my app, the index.html output file contains the meta tag, however instead of referencing the path of the .webmanifest file, it has converted the entire file into base64. Because of this some browsers cannot find the .manifest file and therefore the website cannot be installed as a PWA.
I assume the problem/possible solution lies in the compiler/build options of vite, however I don't know how to fix this auto-conversion.
Here is the github repo: https://github.com/PluginDev-A/Website
the compiled index.html file is in the dist directory, the original index.html file is in the main directory. The problem is on line 6 of both files
**It does not matter whether the file-extention is .json or .webmanifest, both urls get converted upon build
That file should be probably placed in public directory because it is:
Never referenced in source code (e.g. robots.txt)
Must retain the exact same file name (without hashing)
And it should be referenced from index.html with absolute path
<link rel="manifest" href="/manifest.webmanifest">

Weird issue with download trigger

I have a flask app in which I have a front end html with multiple features.
This front end html template has a "download button" to download a file.
This is how I am triggering a download:
$('#download_excel').attr('onClick',"window.open('/static/excel.xlsx')");
download_excel corresponds to a bottom to download a file. This works fine.
But, if I move my excel.xlsx file to a different folder say "download" and modify the above line to this:
$('#download_excel').attr('onClick',"window.open('/download/excel.xlsx')");
This show no file here: (http://127.1.1.1:5555/download/excel.xlsx)
Why? what is the difference?
The problem is that Flask only serves files from the static folder. You have to specify another static folder path as described here: https://stackoverflow.com/a/9519004/5868802
This is because Flask has a default endpoint for static files (files accessible publicly) at /static. This endpoints binds to directory static in your project folder.
You can rebind this endpoint in Flask constructor:
Flask(__name__, static_url_path="/download", static_folder='download')

How do I access my files saved onto my express server?

Currently, I can 'upload' my images onto my server with Multer but now, how can I serve that file? If I visit the path which is: http://localhost:3001/public/backend/public/uploads/user-admin-1556247519876.PNG, i get a 404 cannot get.
I feel like i'm just missing a single step but I can't spot my error.
To serve static files such as images, CSS files, and JavaScript files, use the express.static built-in middleware function in Express.
For example, use the following code to serve images, CSS files, and JavaScript files in a directory named public:
app.use(express.static('public'))
Now, you can load the files that are in the public directory:
http://localhost:3000/images/kitten.jpg
http://localhost:3000/css/style.css
http://localhost:3000/js/app.js
http://localhost:3000/images/bg.png
http://localhost:3000/hello.html
Express looks up the files relative to the static directory, so the name of the static directory is not part of the URL.

Linking a local copy of bootstrap

So Im trying to link a local copy of bootstrap (It works with a CDN). I have bootstrap.css installed in the same directory as index.ejs and yet I keep getting these 404 errors.
So the file path for bootstrap.css is /home/daniel/scheduler/doc_display/app/bootstrap.css
and index is: /home/daniel/scheduler/doc_display/app/index.ejs
Any help would be much apreciated
Your browser is going to look for the file relative to the location of the page it loads, so you need to make sure your path is correct.
Right now it's looking for it in the same folder as the index, which it looks like isn't where it's located.
I put the bootstrap.css file inside of my dist directory then included the new path inside the link tag. For some reason webpack seems to find paths when they are in the dist directory

How do you change file paths in Angular app?

I'm looking at this sample Angular application.
In the index.html file, there are lines like
<script type="text/javascript" src="/static/angular.js"></script>
However, upon closer inspection there are no folders in the project called static.
How does this work? How does angular locate these references?
Angular has nothing to do with this. It is the express server which takes care of the paths.
Take a look at server/config.js. You will see staticUrl: '/static' mentioned there.
Now open server/server.js (server.js is the script which runs before anything else runs in the app so all the configuration is done within this file) and on line 21 you will see require('./lib/routes/static').addRoutes(app, config);. This requires the static.js file which instructs the app to use /static (mentioned in the config.js file) as the path for static files such as CSS and javascript files.
This is a server side phenomenon. There is a middleware in this file server/lib/routes/static.js :
line : 9
app.use(config.server.staticUrl, express.static(config.server.distFolder));
What this does is : if any http request is started from config.server.staticUrl (whitch is /static for this app) the server tries to respond with the resource that are kept in a config.server.distFolder folder (which is client/dist for this app).
For example :
when you request to this url /static/angular.js the middleware tries to find angular.js file in client/dist/. Because client/dist directory is mapped to the url which starts with /static by the middleware.
When that HTML file is processed by the browser, the layout engine is making a separate HTTP request to the server to download the resource in question:
/static/angular.js
Since all of that is handled by the server routing mechanism there doesn't have to be a folder named static in client code. Your example is using Node.js Express routing which maps /static routes to actual physical paths.
Here is a piece of code that configures static routes:
https://github.com/angular-app/angular-app/blob/master/server/config.js
The important parts are:
staticUrl: '/static', // The base url from which we serve static files (such as js, css and images)
And the destination folder that /static maps to:
distFolder: path.resolve(__dirname, '../client/dist'), // The folder that contains the application files (note that the files are in a different repository) - relative to this file
Per the documentation the dist folder contains the Grunt build results, and if you take a look at the gruntfile you will find all the grunt configuration that makes this possible.
https://github.com/angular-app/angular-app/blob/master/client/gruntFile.js

Categories