Uploading an image to the server using CakePHP 1.3

I'm currently trying to implement image upload using CakePHP 1.3.

I use the dropzonejs library to process the send and send request for the server, the documentation for this library says the following:

Server side implementation

Dropzone does not provide a server-side file processing implementation, but the file upload method is identical to the file upload forms:

<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="file" />
</form>

I found an image upload code that looks like it works, however I don’t know how to get a send request using CakePHP 1.3.

Information about my setup

Image loading is located on the view: banners\admin_index.ctp URL of this site:site.com/admin/banners/

banners_controller.ctp, :

  • admin_index() -
  • add() - $this->data uploadFile()
  • uploadFile() -

add() uploadFile() . , .

, , dropzone.js:

<form action="add" class="dropzone" id="adropzone"></form>

add, " 0 ". Chrome, "admin/banners/add" (failed) net::ERR_BLOCKED_BY_CLIENT. , : ERR_TOO_MANY_REDIRECTS.

CakePHP 1.3, , .

.

+4

Source: https://habr.com/ru/post/1609967/


All Articles