Motivation
Current behavior incompatible with TWiki 4. Extends current behavior without compromising any current usage of the Upload script
Description and Documentation
See
Item6805
for detail.
Inroducing a few new input fields(filename, filename1... filename9) for user specified attachment names. If the fields are empty or are not specified then behavior remains unchanged.
Your form should be defined similar to following:
<form enctype="multipart/form-data" action="%SCRIPTURLPATH{upload}%/%WEB%/%TOPIC%" method="post">
<input type="text" name="filename" value="" size="70" />
<input type="text" name="filename1" value="" size="70" />
<input type="text" name="filename2" value="" size="70" />
<input type="text" name="filename3" value="" size="70" />
....
<input type="file" name="filepath" value="" size="70" />
<input type="file" name="filepath1" value="" size="70" />
<input type="file" name="filepath2" value="" size="70" />
<input type="file" name="filepath3" value="" size="70" />
....
<input type="submit" value='Upload file' />
</form>
Examples
<form enctype="multipart/form-data" name="main" enctype="multipart/form-data" action="%SCRIPTURL{"upload"}%/%WEB%/%URLPARAM{"page"}%" method="post">
<input type="hidden" name="filename" value="newName.txt"/>
<input type="hidden" name="skin" value="%URLPARAM{skin}%" />
| *Path* | <input type="file" name="filepath" value="" size="70"/> |
<input type="hidden" name="filecomment" value="SomeComment"/>
<input type="hidden" name="createlink" />
<input type="hidden" name="hidefile" />
<br /><input type="submit" value=" Upload File" />
</form>
Impact
Implementation
Modified script file attached.
- Upload.pm.txt: Modified Upload script to accept user specified attachment names
--
Contributors: DebabrataDas - 2011-09-08
Discussion
I am all for adding the new feature. Spec is clear as for form field names (such
filename2) and backend processing by the upload script. That way, custom file upload forms can be created to take advantage of this feature.
However, I am not sure if the filename input fields should be shown in the standard attach screen, unless we find a very intuitive and non-intrusive way to do that. Example attach screen as it is now:
- Sample attach screen with three files ready for upload:
Not sure how / where the file name input fields would go. May be show input fields next to the red

icon instead of the read only text? Show it pre-filled with actual name?
As for contribution, it is better to attach a diff instead of the .pm file so that it is easy to spot what the changes are.
--
PeterThoeny - 2011-09-08
Here is a non-functioning mockup of an attach screen that allows rename of attachment on upload.
I do not like/favor it, it is too busy and distracting. I suggest to add the feature in the backend and document it, but to leave the attach screen as it is now.
--
PeterThoeny - 2011-09-08
I agree. There is no urgent reason to change the attach screen. Our immediate requirement is that we allow users to upload documents using our application, and we need to ensure that different users can upload files with identical names, but associated with different objects, and the new attachment does not overwrite the earlier one.
--
DipuDeshmukh - 2011-09-09
Here is the patch file that contains only the differences between the original and the modified Upload.pm script.
--
DebabrataDas - 2011-09-09
Dipu, we are in agreement.
Debabrata, the patch looks good. I suggest to ask for
SVN access so that you can checkin directly. See
GettingInvolved,
ReadmeFirst,
SoYouWantToBeATWikiDeveloper, and then
RequestAccessToSubversion.
Wait for the
AcceptedBy7DayFeedbackPeriod before checkin. See
TWikiReleaseManagementProcess,
--
PeterThoeny - 2011-09-09
I think this is a small & safe enough enhancement that can go into the next TWiki-5.1 patch release. George?
--
PeterThoeny - 2011-09-10
What a nice usability feature. I'd favor including the rename on upload option on the standard attach screen. To keep the current clean attach look and feel, how about a simple column labeled "rename?" with a checkbox aligned with the red

icon? When checked, the row of the file expands to includes the columns as shown in the mockup.
--
GeorgeTrubisky - 2011-09-14
May be track the rename in standard attach screen in a separate proposal, and keep this one just for the backend?
I can commit to defining the UI with usability in mind, but I do not have the time to code the
CSS/JavaScript.
--
PeterThoeny - 2011-09-14