Я предполагаю, что Вы хотите заставить загрузку запуститься сразу же. Если так, необходимо реагировать на change
событие в JavaScript, и просто заставить его отправить форму.
<!-- HTML code --->
<input
type="file"
onchange="if (confirm('Upload ' + this.value + '?')) this.form.submit();"
>
Выяснение у пользователей для подтверждения рекомендуемо, таким образом, они остаются в управлении процесса и могут отменить, если они выбрали неправильный файл случайно.
If you just want to find this out on a given dll, then you can use the CorFlags tool that is part of the Windows SDK:
CorFlags.exe assembly.dll
If you want to do it using code, take a look at the GetPEKind method of the Module class:
Assembly assembly = Assembly.LoadFrom("path to dll");
PortableExecutableKinds peKind;
ImageFileMachine imageFileMachine;
assembly.ManifestModule.GetPEKind(out peKind, out imageFileMachine)
You then need to examine the peKind
to check its value. See the MSDN docs for PortableExecutableKinds
for more info.
Спасибо, Адриан! Я переписал фрагмент в PowerShell, чтобы я мог использовать его на сервере.
#USAGE #1
# Get-Bitness (dir *.dll | select -first 1)
#USAGE #2
# Get-Bitness "C:\vs\projects\bestprojectever\bin\debug\mysweetproj.dll"
function Get-Bitness([System.IO.FileInfo]$assemblyFile)
{
$peKinds = new-object Reflection.PortableExecutableKinds
$imageFileMachine = new-object Reflection.ImageFileMachine
$a = [Reflection.Assembly]::LoadFile($assemblyFile.Fullname)
$a.ManifestModule.GetPEKind([ref]$peKinds, [ref]$imageFileMachine)
return $peKinds
}