Delphi取得目前檔案位置名稱路徑

  // 假如程式路徑在 c:\projects\bin\project1.exe
  ShowMessage('Drive = '+ExtractFileDrive (Application.Exename));  //C:
  ShowMessage('Dir   = '+ExtractFileDir   (Application.Exename));  //c:\projects\bin 
  ShowMessage('Path  = '+ExtractFilePath  (Application.Exename));  //c:\projects\bin\
  ShowMessage('Name  = '+ExtractFileName  (Application.Exename));  //project1.exe
  ShowMessage('OnlyName ='+ChangeFileExt(ExtractFileName(Application.Exename), ''));  //project1
  ShowMessage('Ext   = '+ExtractFileExt   (Application.Exename)); //.exe

form加上enctype=multipart/form-data作用

在設計表單時,如果內容有檔案時,我們都會在上面加上enctype=”multipart/form-data”。其實form的enctype有三種

  • application/x-www-form-urlencoded
  • multipart/form-data
  • text/plain

預設的狀況下都是以application/x-www-form-urlencoded為主,會將資料做編碼傳送(空白以+代替,而特殊字元則傳成ASCII HEX。而multipart/form-data則是不做任何編碼,如果需要上傳文件時,就要使用它;text/plan則是僅將空白以+代替,常見於電子郵件表單。

 

 

延伸閱讀:

http://www.w3.org/TR/html401/interact/forms.html