File

File control for posting client-side files.

When used in conjunction with newedit additional control-names are also returned. If file-control ID is @X then parameters @XxxFileName, @XxxContentType and @XxxContentSize are also posted. (ContentSize is only returned for legacy reasons and you can safely ignore its value. If you need to determine the length of your data then use the DATALENGTH function.)

CREATE PROCEDURE xxx_InsertUpdate
  ...
  @Xxx varbinary(max),
  @XxxFileName nvarchar(300),
  @XxxContentType varchar(300),
  @XxxContentSize int
AS
...

When the control is set to support upload of multiple files (version 6.1 and later only) the files are returned as a temporary table with the columns FileName, ContentType and File.

Start value: n/a
Return value: Selected file from local/network hard drive.
Supported in: NewEdit

Appearance

alt text
The "Choose File" button opens a standard file dialog where the user can select a file to upload.

Best practice

GetEditFields

Use CONVERT(varbinary(MAX), NULL) in GetEditFields instead of returning file data which will be discarded anyway.