![]() |
admin 10/31/2017 |
You can see the code that shows how to rename files at https://xlinesoft.com/asprunnerpro/docs/rename_uploaded_files.htm To find a file extension you need to parse the file name, find the last dot and everything after that dot will be your extension. |
I
|
i.NoLim author 10/31/2017 |
You can see the code that shows how to rename files at https://xlinesoft.com/asprunnerpro/docs/rename_uploaded_files.htm. To find a file extension you need to parse the file name, find the last dot and everything after that dot will be your extension. The only flaw here is that this code normally to be placed to BeforeAdd/BeforeEdit events where your Unique ID number is not generated yet. Typically autoincrement number are generated by the database when record is added and not before that.
I already looked at this page
error CS0131: The left-hand side of an assignment must be a variable, property or indexer
|
![]() |
admin 10/31/2017 |
If you getting an error message that means you doing something wrong. This code is tested and works. |
I
|
i.NoLim author 10/31/2017 |
I've never actually used VB so I'm having some issues with the code. I understand its grabbing the names of the files uploaded and storing them in an array. It then uses a for loop to go into the array, grabs each individual file and renames it. I'm not entirely sure what's going on in lines 31 and 32, it seems like its moving the file? Line 38 updates the value in the DB. |
I
|
i.NoLim author 10/31/2017 |
If you getting an error message that means you doing something wrong. This code is tested and works. It is also possible to implement a similar technique in events like AfterAdd and AfterEdit. Instead of assigning a value to values("fieldname") you will need to build and execute a SQL query that updates "fieldname" field in the database.
|
![]() |
admin 11/1/2017 |
It looks like you use ASPRunner.NET but post your questions to ASPRunnerPro forum and get ASPRunnerPro specific answers. |
I
|
i.NoLim author 11/1/2017 |
It looks like you use ASPRunner.NET but post your questions to ASPRunnerPro forum and get ASPRunnerPro specific answers.
|
I
|
i.NoLim author 11/2/2017 |
I'm more versed in C++ so my pseudo code is a mixture of it and SQL, now I just need to "translate" it,
[{"name":"C:\\Users\\username\\Documents\\Uploads/abcd_udod4v5p.jpg","usrName":"abcd.jpg","size":1013329,"type":"image/jpeg","searchStr":"abcd.jpg,!12345.txt,!:sStrEnd"},{"name":"C:\\Users\\username\\Documents\\Uploads/12345_o6sq520f.txt","usrName":"12345.txt","size":288,"type":"text/plain"}] |
I
|
i.NoLim author 11/8/2017 |
I ended up using the following code in the "After record added" event. My only issue is when the upload folder is changed to something like C:\Users\nameofuser\Documents\Uploads. I've attached pictures of my code, error, whats displayed in my DB field, and the settings for said field. As you can see from the third picture, the path in the DB has 2 backslashes; this is most likely causing the issue. |