File upload
File upload
If I have Editor set to use an AJAX call to get the data, when uploading a file... should the url sent to server be different than AJAX I set? I have no problem getting, creating, editing, or deleting the data. Only problem is when I attempt to upload a file, it uses a completely different URL so it says route not found (using symfony).
->upload(
Upload::inst($dirPath . '__ID__.__EXTN__')
->db('uploads', 'id', array(
'file_name' => Upload::DB_FILE_NAME,
'file_size' => Upload::DB_FILE_SIZE,
'web_path' => Upload::DB_WEB_PATH,
'system_path' => Upload::DB_SYSTEM_PATH
))
->validator(Validate::fileExtensions(['pdf'], "Please upload a pdf file"))
->dbClean(function ($data) {
// Remove the files from the file system
for ($i = 0, $ien = count($data); $i < $ien; $i++) {
unlink($data[$i]['systemPath']);
}
// Have Editor remove the rows from the database
return true;
})
)
Answers
Looking at the
upload
docs there is an optional optionajax
which states this:Sounds like you have the choice of what url to use.
Do you have the
ajax
option of theupload
configured? Have you tried commenting it out so theajax
url is used?If you want to use a different url then you will need to setup the web server environment to support that route.
Kevin