This topic is locked

Uploading files with same name

6/15/2016 1:44:04 PM
ASPRunner.NET General questions
W
wayne author

I upgraded to .net from just asp it is a world of a difference but now on my applications if I upload a file with the same file name it never uploads the second file. It use to rename the files for me to (1) (2) something like that. How can I attach an image (from a mobile device especially) if I cant send all the files up to the record. If I take a picture with a mobile device it attaches a file called image to the record...well if I take another picture with a mobile device it also attaches a file called image. In ASPrunner I could do this but now that I have switched to .net it wont. What am I doing wrong or missing? I don't want to have to take the pictures save them to the phone then go into the app and attach them. It is a lot easier to just attach them as I take them so users don't attach the wrong pictures. Thanks in advance.

Sergey Kornilov admin 6/15/2016

Show us a screenshot of 'Edit as' settings of your upload field.

W
wayne author 6/15/2016



Show us a screenshot of 'Edit as' settings of your upload field.




Sergey Kornilov admin 6/15/2016

Everything looks good to me. It should be adding a random string to each uploaded file name so files won't be overwritten.

W
wayne author 6/21/2016



Everything looks good to me. It should be adding a random string to each uploaded file name so files won't be overwritten.


I have looked at everything and I really think it is something with asprunner.net. I can create a website with asprunner and it works fine but doesn't with the same database and same server and same folder rights when I do it with asprunner.net. It puts the files up on the web server and gives them a unique filename on the server but never gives them a unique filename on the application itself like asprunner did. On ASPrunner if I added two files to the same record it would put (1) after the file name. For example if I added test.jpg then added another file named the same thing it would look like this on the site test(1).jpg. If I use the same iis folder and load the same program but in asprunner instead of .net it works fine so I am certain it isn't the security. I have figured out that I can add both files IF I upload them at the same time instead of one at a time. However if I go to delete one of the files it deletes them both because the application doesn't think they are different files.

Pete K 6/22/2016

This is interesting, Wayne. I am having a similar but slightly different issue with the exact same situation you describe. In my case, however, my app refuses to upload duplicate file names. If the same file has already been uploaded, clicking on the upload button for another file with the same name results in nothing happening. And if I attempt to upload them both at the same time, I get an error message ("Uploading failed").
[media]https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=79644&image=1&table=forumreplies[/media]
My version is ASPRunner.NET Enterprise 8.1 (Build 25449 x64).

W
wayne author 6/22/2016



This is interesting, Wayne. I am having a similar but slightly different issue with the exact same situation you describe. In my case, however, my app refuses to upload duplicate file names. If the same file has already been uploaded, clicking on the upload button for another file with the same name results in nothing happening. And if I attempt to upload them both at the same time, I get an error message ("Uploading failed").
[media]https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=79645&image=1&table=forumreplies[/media]
My version is ASPRunner.NET Enterprise 8.1 (Build 25449 x64).


Yes that is pretty much identical. You just explained it better than I did. I have figured out that if I upload duplicate files with the same filename at the same time they do upload and create two files in the iis directory but it never changes the name of the attachment on the list page or add page to (1) or (2) like asprunner applications do. This confuses the application because the two attachments to the record don't look look at them as unique so if I delete one attachment on the record it deletes both attachments since it is really looking at the same physical file. Like what you are experiencing I too can not attach files with the same file name at different times. When I go to upload the second one it does nothing. No error just doesn't upload until I delete the first one I attached. Furthermore I have also discovered in my testing that with ASPRUNNER.NET the files I upload will not delete off the server unless I use the absolute path. I am also using the same build as you are. It has to be a bug in the application. I cant see it being anything else since I can create the same application in ASPRUNNER and it works fine using the same server directories.

Sergey Kornilov admin 6/22/2016

There must be some misunderstanding here. ASPRunnerPro or any other products do not have functionality to add postfixes like (1) or (2). What it typically does is renames the file to something like this: upload_shw4xjxs.txt. You can upload as many such files as you want with the same name. They will be renamed according to upload_13704bxw.txt, upload_y0oyvatt.txt etc.
You cannot though add two files with the same name to the same record. Within record all files must have unique names. ASPRunner.NET and ASPRunnerPro and PHPRunner (unless you use 'Basic' upload control) store uploaded files info in JSON format like this:

[{"name":"files/event_non6v0jn.txt","usrName":"event.txt","size":2490,"type":"text/plain","searchStr":"event.txt,!tmp.txt,!:sStrEnd"},{"name":"files/tmp_j753em5a.txt","usrName":"tmp.txt","size":8146,"type":"text/plain"}]



The original file name serves as a key in this JSON array and thus must be unique. You can add file with the same name to another record though.

Pete K 6/23/2016



There must be some misunderstanding here. ASPRunnerPro or any other products do not have functionality to add postfixes like (1) or (2). What it typically does is renames the file to something like this: upload_shw4xjxs.txt. You can upload as many such files as you want with the same name. They will be renamed according to upload_13704bxw.txt, upload_y0oyvatt.txt etc.
You cannot though add two files with the same name to the same record. Within record all files must have unique names. ASPRunner.NET and ASPRunnerPro and PHPRunner (unless you use 'Basic' upload control) store uploaded files info in JSON format like this:

[{"name":"files/event_non6v0jn.txt","usrName":"event.txt","size":2490,"type":"text/plain","searchStr":"event.txt,!tmp.txt,!:sStrEnd"},{"name":"files/tmp_j753em5a.txt","usrName":"tmp.txt","size":8146,"type":"text/plain"}]



The original file name serves as a key in this JSON array and thus must be unique. You can add file with the same name to another record though.


That makes sense. I wasn't really trying to do that, just verifying that Wayne's issue wasn't unique to him.

W
wayne author 7/29/2016



There must be some misunderstanding here. ASPRunnerPro or any other products do not have functionality to add postfixes like (1) or (2). What it typically does is renames the file to something like this: upload_shw4xjxs.txt. You can upload as many such files as you want with the same name. They will be renamed according to upload_13704bxw.txt, upload_y0oyvatt.txt etc.
You cannot though add two files with the same name to the same record. Within record all files must have unique names. ASPRunner.NET and ASPRunnerPro and PHPRunner (unless you use 'Basic' upload control) store uploaded files info in JSON format like this:

[{"name":"files/event_non6v0jn.txt","usrName":"event.txt","size":2490,"type":"text/plain","searchStr":"event.txt,!tmp.txt,!:sStrEnd"},{"name":"files/tmp_j753em5a.txt","usrName":"tmp.txt","size":8146,"type":"text/plain"}]



The original file name serves as a key in this JSON array and thus must be unique. You can add file with the same name to another record though.


Yes I understand the (1) and (2) issue but I was really using that as an example. The problem is that the application will create the unique filename on the server but it never carries over onto the application. It will not allow me to save two files with the same file name. It is obvious that others are having the same issue as well.

Sergey Kornilov admin 7/29/2016

If anyone is having any sort of issue they should contact support. This should not be happening.