CreateNewFile Property

Object: SoftArtisans.FileUp
Syntax: CreateNewFile[=Boolean]
Type: Boolean
Read/Write: Read/Write
Description:

This property can generate unique file names.

If CreateNewFile is set to TRUE, FileUp will automatically append an underscore and a number between 0 and 999 to the name of the file being uploaded, if a file with the same name already exists in the upload directory.

CreateNewFile is set to FALSE by default. To use this property, set CreateNewFile to TRUE, after creating an instance of the FileUp object, and before referencing any form elements.

Note: Because this property must be set before the upload contents are cached, this property is ineffective in an ASP.NET environment when the HttpModule is employed.
Examples:
ASP <%
'--- Create an instance of SoftArtisans FileUp.
Set fileUpload = Server.CreateObject(SoftArtisans.FileUp)

'--- Set the default path to store uploaded files.
fileUpload.Path = "C:\temp"

'--- Instruct FileUp to generate a unique file name if the
'--- file's original name already exists on the server.
'--- Important: Set CreateNewFile before referencing form elements.
fileUpload.CreateNewFile = True

'--- Save the file.
fileUpload.Save

'--- Write out its new, unique name.
Response.Write "File saved as: " & fileUpload.ServerName
%>
ASP.NET N/A

Copyright © 2010 SoftArtisans, Inc. All rights reserved.