You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-19Lines changed: 19 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,18 +4,18 @@ PunkAveFileUploaderBundle
4
4
Introduction
5
5
============
6
6
7
-
This bundle provides multiple file uploads, based on the [BlueImp jQuery file uploader](https://github.com/blueimp/jQuery-File-Upload/) package. Both drag and drop and multiple file selection are fully supported in compatible browsers. We chose BlueImp because it has excellent backwards and forwards browser compatibility.
7
+
This bundle provides multiple file uploads, based on the [BlueImp jQuery file uploader](https://github.com/blueimp/jQuery-File-Upload/) package. Both drag and drop and multiple file selection are fully supported in compatible browsers. We chose BlueImp because it has excellent backwards and forwards browser compatibility.
8
8
9
9
This bundle is a fairly thin wrapper because the existing PHP uploader class provided by BlueImp is very good already and does so many excellent things straight out of the box. We provided a way to integrate it into a Symfony 2 project.
10
10
11
-
The uploader delivers files to a folder that you specify. If that folder already contains files, they are displayed side by side with new files, as existing files that can be removed.
11
+
The uploader delivers files to a folder that you specify. If that folder already contains files, they are displayed side by side with new files, as existing files that can be removed.
12
12
13
13
The bundle can automatically scale images to sizes you specify. The provided synchronization methods make it possible to create forms in which attached files respect "save" and "cancel" operations.
14
14
15
15
Note on Internet Explorer
16
16
=========================
17
17
18
-
Versions of Internet Explorer prior to 10 have no support for multiple file uploads. However IE users will be able to add a single file at a time and will still be able to build a collection of attached files.
18
+
Versions of Internet Explorer prior to 10 have no support for multiple file uploads. However IE users will be able to add a single file at a time and will still be able to build a collection of attached files.
19
19
20
20
Requirements
21
21
============
@@ -31,7 +31,7 @@ Installation
31
31
Symfony 2.0
32
32
-----------
33
33
1) Add the following line to your Symfony2 deps file:
'viewUrl': {{ '/uploads/tmp/attachments/' ~ editId | json_encode | raw }},
177
177
'el': '.file-uploader',
178
-
'existingFiles': {{ existingFiles | json_encode | raw }},
178
+
'existingFiles': {{ punkave_get_files('tmp/attachments/' ~ editId) | json_encode | raw }},
179
179
'delaySubmitWhileUploading': '.edit-form'
180
180
});
181
181
});
@@ -231,8 +231,8 @@ Again, handleFileUpload DOES NOT RETURN as the response is generated in native P
231
231
232
232
Setting the allowed file types
233
233
------------------------------
234
-
You can specify custom file types to divert from the default ones (which are defined in Resources/config/services.yml) by either specifing
235
-
them in the handleFileUpload method or parameters.yml.
234
+
You can specify custom file types to divert from the default ones (which are defined in Resources/config/services.yml) by either specifing
235
+
them in the handleFileUpload method or parameters.yml.
236
236
237
237
***In the handleFileUpload:***
238
238
@@ -280,9 +280,9 @@ Consider installing this shell script as a cron job to be run nightly. This shel
280
280
Configuration Parameters
281
281
========================
282
282
283
-
See `Resources/config/services.yml` in this bundle. You can easily decide what the parent folder of uploads will be and what file extensions are accepted, as well as what sizes you'd like image files to be automatically scaled to.
283
+
See `Resources/config/services.yml` in this bundle. You can easily decide what the parent folder of uploads will be and what file extensions are accepted, as well as what sizes you'd like image files to be automatically scaled to.
284
284
285
-
The `from_folder`, `to_folder`, and `folder` options seen above are all appended after `file_uploader.file_base_path` when dealing with files.
285
+
The `from_folder`, `to_folder`, and `folder` options seen above are all appended after `file_uploader.file_base_path` when dealing with files.
286
286
287
287
If `file_uploader.file_base_path` is set as follows (the default):
288
288
@@ -305,21 +305,21 @@ So all of these can be readily accessed via the following URLs:
305
305
306
306
And so on.
307
307
308
-
The original names and file extensions of the files uploaded are preserved as much as possible without introducing security risks.
308
+
The original names and file extensions of the files uploaded are preserved as much as possible without introducing security risks.
309
309
310
310
Limit number of uploads
311
311
-----------------------
312
312
313
313
You can limit the number of uploaded files by setting the `max_no_of_files` property. You could set this in parameters.yml like this:
314
-
314
+
315
315
parameters:
316
316
file_uploader.max_number_of_files: 4
317
317
318
318
You'll probably want to add an error handler for this case. In the template where you initialize PunkAveFileUploader set `errorCallback`
319
319
320
320
// Enable the file uploader
321
321
$(function() {
322
-
new PunkAveFileUploader({
322
+
new PunkAveFileUploader({
323
323
// ... other required options,
324
324
325
325
'errorCallback': function(errorObj) {
@@ -333,7 +333,7 @@ You'll probably want to add an error handler for this case. In the template wher
333
333
Limitations
334
334
===========
335
335
336
-
This bundle accesses the file system via the `glob()` function. It won't work out of the box with an S3 stream wrapper.
336
+
This bundle accesses the file system via the `glob()` function. It won't work out of the box with an S3 stream wrapper.
337
337
338
338
Syncing files back and forth to follow the editId pattern might not be agreeable if your attachments are very large. In that case, don't use the editId pattern. One alternative is to create objects immediately in the database and not show them in the list view until you mark them live. This way your edit action can use the permanent id of the object as part of the `folder` option, and nothing has to be synced. In this scenario you should probably move the attachments list below the form to hint to the user that there is no such thing as "cancelling" those actions.
0 commit comments